DAX Sum of Average to Rank

老子叫甜甜 提交于 2019-12-11 15:48:32

问题


I have a pivot table that pulls a rate by person from powerpivot. The rate is a calculated field, not a column and I need the Grand Total to show as a SUM of the rates, not an average. This is purely for ranking purposes to show who has the highest overall rates to lowest. This is what it looks like with the field I want:

Person Jan-2018 Feb-2018 Mar-2018 GrandTotal [DesiredField] A 80% 71% 82% 77.6% 233% B 76% [blank] 85% 80.5% 161% C 82% 85% 79% 82% 246%

So person C would be at the top followed by A then B. Due to OLAP limitations I can't create a calculated field and 'Summarize Values By' field is greyed out. If there is a better work around please let me know.


回答1:


Since there's no data model given, I assume you have a measure (calculated field), some persons and a Date dimension with a 'Month-Year' column.

You could try the SUMX function, it iterates over a given table of values. In this case, you need to sum up the calculated [Rate], for each 'Month-Year'.

Example:

SumRatePerMonth :=
SUMX(
     VALUES('DimDate'[Year-Month]),
     [Rate]
)

The formula iterates over the [Month-Year] column in the DimDate table*, calculates the [Rate] for each [Month-Year], and sums it.

Note: Like I said, I assume you have a some sort of Date dimension, from which you pull the Month-Year column. If my assumption is wrong, please provide us with a sample or screenshot of your datamodel.



来源:https://stackoverflow.com/questions/49577436/dax-sum-of-average-to-rank

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!