我有一个基于下表的数据透视表(带有数据模型)
Id | Time
1 | 10
1 | 10
1 | 10
2 | 2
3 | 5
3 | 5
4 | 4
5 | 8
我需要计算平均时间。
基于数据透视表计算的平均值为 6.75
--> (10*3+2+5*2+4+8)/8
然而,我的预期结果是 5.8
--> (10+2+5+4+8)/5
如何设置数据透视表不考虑重复数据?
请注意,我无法删除重复的行。
我尝试将 AVERAGEX
: =AVERAGEX(VALUES('Range'[Id]);'Range'[Time])
与 DAX 一起使用。
但我正面临这个问题:This formula is invalid or incomplete: 'Calculation error in measure 'Range'[475e7fe7-92b4-478c-bd5f-6e7c95df27d7]: A single value for column 'Time' in table 'Range' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.'.
先谢谢你!
解决方案
=AVERAGEX(VALUES('Range'[Id]);CALCULATE(AVERAGE('Range'[Time])))
答案 0 :(得分:0)
解决方案
=AVERAGEX(VALUES('Range'[Id]);CALCULATE(AVERAGE('Range'[Time])))