[英]Power BI Calculated measure to count three specific values from a column
I have a table with 500 rows and one of the columns contains a few different values. 我有一个包含500行的表,其中一列包含一些不同的值。 I want to return a measure that counts the total number of three of the values.
我想返回一个对三个值的总数进行计数的度量。 So for example, in the pic below, I want to calculate the number of times Ages 11, 12 and 13 appears in the table - which is 7 times.
因此,例如,在下面的图片中,我想计算年龄11、12和13在表中出现的次数-这是7次。 What is the DAX language for this?
DAX的语言是什么? Thank you
谢谢
https://i.stack.imgur.com/50ci5.png https://i.stack.imgur.com/50ci5.png
The 'IN' function will do this pretty cleanly. “ IN”功能将非常干净地执行此操作。 It will let you build a filter that limits your table to the rows whose values match the ones in a list that you supply.
它将允许您构建一个筛选器,以将表限制为其值与您提供的列表中的值相匹配的行。 Then just count them up.
然后算一下。
CountSpecificAges = CALCULATE(
COUNT (Table1[Age])
, Table1[Age] IN {11, 12, 13}
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.