Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (17.6k points)

I am new to PowerBI and writing DAX expressions.

I have a table with a text column with different values. All I want to do is get the count for each distinct value. It's easily achieved with this SQL but I can't get the right DAX expression for it.

select [value],count(*) as TagCount from Tags

group by [value]

order by TagCount desc

Any help? 

closed

1 Answer

0 votes
by (47.2k points)
selected by
 
Best answer
  • We can use either of these

SUMMARIZE(Tags, Tags[value], "TagCount", COUNT(Tags[value]))

(or)

SUMMARIZECOLUMNS(Tags[value], "TagCount", COUNT(Tags[value]))

  • We can even do this as a matrix visual with Tags[value] for the Rows and the measure COUNT(Tags[value]) for the values and then sort by whichever column you choose by clicking the column heading on the visual.

Related questions

0 votes
1 answer
asked Nov 4, 2020 in BI by Sudhir_1997 (55.6k points)
0 votes
1 answer
0 votes
1 answer
asked Mar 15, 2023 in BI by Nisha S (31.8k points)

Browse Categories

...