问题描述
我是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.
这篇关于COUNT个GROUPBY的DAX表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!