Pivot Table 考虑重复元素进行平均计算
Pivot Table considers duplicate elements for the average calculation
我有一个基于以下 table
的数据透视表 table(带有数据模型)
Id | Time
1 | 10
1 | 10
1 | 10
2 | 2
3 | 5
3 | 5
4 | 4
5 | 8
我需要计算平均时间。
基于枢轴 table 计算的平均值为 6.75
--> (10*3+2+5*2+4+8)/8
然而,我的预期结果是 5.8
--> (10+2+5+4+8)/5
如何设置枢轴 table 以不考虑重复项?
请注意,我无法删除重复的行。
我尝试使用 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])))
解决方案
=AVERAGEX(VALUES('Range'[Id]);CALCULATE(AVERAGE('Range'[Time])))
我有一个基于以下 table
的数据透视表 table(带有数据模型)Id | Time
1 | 10
1 | 10
1 | 10
2 | 2
3 | 5
3 | 5
4 | 4
5 | 8
我需要计算平均时间。
基于枢轴 table 计算的平均值为 6.75
--> (10*3+2+5*2+4+8)/8
然而,我的预期结果是 5.8
--> (10+2+5+4+8)/5
如何设置枢轴 table 以不考虑重复项?
请注意,我无法删除重复的行。
我尝试使用 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])))
解决方案
=AVERAGEX(VALUES('Range'[Id]);CALCULATE(AVERAGE('Range'[Time])))