[英]Sum of rows that satisfy a calculated measure in Power BI
All.全部。
I have a set of data that includes the following:我有一组数据,包括以下内容:
Each survey has a score, and then the overall score for that store is calculate as an average.每项调查都有一个分数,然后计算该商店的总分作为平均值。
The score is a calculated measure based off 3 other calculated measures.该分数是基于 3 个其他计算指标计算得出的指标。 These are created as below:这些创建如下:
Overall Score 1 = CALCULATE(CALCULATE(COUNT('Table'[Score 1]), 'All Detail'[Score 1] = 5) / (COUNT('Table'[Score 1]))) * 100
Overall Score 2 = CALCULATE(CALCULATE(COUNT('Table'[Score 2]), 'All Detail'[Score 2] = 5) / (COUNT('Table'[Score 2]))) * 100
Overall Score 3 = CALCULATE(CALCULATE(COUNT('Table'[Score 3]), 'All Detail'[Score 3] = 5) / (COUNT('Table'[Score 3]))) * 100
Score = ([Overall Score 1] + [Overall Score 2] + [Overall Score 3])/3
I am wanting to count how many stores have beat a target score.我想计算有多少商店超过了目标分数。
Currently I have a calculated measure which indicates that the store has beat the target:目前我有一个计算指标表明商店已经超过了目标:
Achieved = IF([Score] >= 60, 1, 0)
This works well on a cube at Store level, telling me that the average score for the store is over 60 or not, as below:这在商店级别的多维数据集上效果很好,告诉我商店的平均分数是否超过 60,如下所示:
However, I am struggling to get the total of stores that have achieved target.但是,我正在努力获得已达到目标的商店总数。 In the example above the total would be 3 stores.在上面的示例中,总数为 3 家商店。
I have tried to create a filter measure as below:我试图创建一个过滤措施如下:
Total Achieved = COUNTROWS(FILTER('Table', [Achieved] = 1))
However, this brings back the number of surveys per store that have beat the target.但是,这会带回每家商店超过目标的调查数量。 Examples below:下面的例子:
As you can see the Total Achieved
calculated measure works well at a survey level but this is not the desired output.如您所见, Total Achieved
计算得出的度量在调查级别上运行良好,但这不是所需的 output。
Example of what I am looking for as the output below:下面是我正在寻找的 output 示例:
Any advice would be appreciated.任何意见,将不胜感激。 I have tried to use calculated columns but with no luck.我曾尝试使用计算列,但没有成功。
Hi this is the expected behavior of table visual first step is to create a summarize table as below.您好,这是表视觉的预期行为第一步是创建一个汇总表,如下所示。 Here I have only group by from 'Table'[Store] use your own grouping conditions.在这里,我只使用来自 'Table'[Store] 的 group by 使用您自己的分组条件。 s秒
sumtable =
ADDCOLUMNS(
SUMMARIZE(
‘Table’,
‘Table'[Store],
),
”Surveys”,SUM(Table[Surveys]),
"Score" ,[Score]
)
After that for the above summarize table create the measure as below之后为上面的汇总表创建如下的度量
Achieved = IF(sumtable[Score] >= 60, 1, 0)
This will ensure your results.这将确保您的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.