DAX expression for COUNT of GROUPBY

半腔热情 提交于 2020-01-23 09:51:10

问题


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?


回答1:


You can do something similar in Power BI as follows:

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

or

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

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



来源:https://stackoverflow.com/questions/46084978/dax-expression-for-count-of-groupby

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!