GROUPBY 的 COUNT 的 DAX 表达式 [英] DAX expression for COUNT of GROUPBY
问题描述
我是 PowerBI 和编写 DAX 表达式的新手.
I am new to PowerBI and writing DAX expressions.
我有一个带有不同值的文本列的表.我要做的就是获取每个不同值的计数.使用此 SQL 很容易实现,但我无法获得正确的 DAX 表达式.
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
有什么帮助吗?
推荐答案
您可以在 Power BI 中执行类似的操作,如下所示:
You can do something similar in Power BI as follows:
SUMMARIZE(Tags, Tags[value], "TagCount", COUNT(Tags[value]))
或
SUMMARIZECOLUMNS(Tags[value], "TagCount", COUNT(Tags[value]))
<小时>
您也可以将其作为矩阵视觉对象,使用 Tags[value]
表示行,使用度量 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.
这篇关于GROUPBY 的 COUNT 的 DAX 表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!