PowerBI措施

时间:2016-07-11 13:04:59

标签: powerbi dax

我有一个powerbi模型来分析调查结果。

我有以下计算的措施:

[distinctcount of respondents this year] = DISTINCTCOUNT('Fact NRPS'[Serial])

[distinctcount of respondents last year] = CALCULATE('Fact NRPS'[Responders], SAMEPERIODLASTYEAR('Dim Dates'[Date]))

[year on year difference] = [distinctcount of respondents this year] - [distinctcount of respondents last year]

在报告中,我按[Question]总结了这些措施。所以我有一个包含这样的列的报告:

[Question][distinctcount of respondents this year][distinctcount of respondents last year][year on year difference]

现在,我想在此报告的底部添加一个摘要行,其中显示[year on year difference]大于零且[year on year difference]小于零的问题数。

所以它会告诉我们45个问题与去年相比有更多的受访者,而21个有更少。

我怎么能在DAX中做到这一点?

  • 我尝试使用SUMMARIZE创建一个度量,按[问题]对数据进行分组,并获得[year on year difference]大于零的问题数。但是,这不起作用。因为总结一下,它不允许我使用另一个计算的度量,即[year on year difference]

  • 如果我添加计算的度量,例如If([year on year difference]>0,1,0),然后在报告中添加总行,则这也不起作用。在这种情况下,它将此计算度量显示为总行的1或0.

关于如何做到这一点的任何想法?

由于

穆罕默德

1 个答案:

答案 0 :(得分:1)

这样的事情应该有效:

Measure = CALCULATE(COUNT([Column]), 
                    FILTER(Table, [Year]=2017)) - CALCULATE(COUNT([Column]),
                    FILTER(Table, [Year]=2016))
相关问题