如何在我的数据透视表中添加加权平均数? [英] How to add a weighted average in my pivot table?
问题描述
我想知道如何在我的数据透视表中添加加权平均数。实际上,我需要做以下计算: SUM(col1 * col2)/ SUM(col2)
。
I would like to know how to add a weighted average in my pivot table. In fact, I need to do the following calculation: SUM(col1 * col2)/SUM(col2)
.
我尝试使用计算的字段选项,但是当我输入我的公式时,我只需输出以下结果: SUM((col1 * col2)/ col2)
等于 SUM(col1)
。
I tried to do it by using the calculated field option but when I enter my formula, I just have the following result as an output: SUM((col1 * col2)/col2)
which is equal to SUM(col1)
.
推荐答案
你需要 1 计算字段,而 1 帮助列
You will need 1 calculated field, and 1 helper column
助手列
col3=col1*col2
字段:
CF=Col3/Col1
如果您尝试将辅助列作为计算字段,则它将与 col1
和 col2
,然后将它们加在一起导致无意义的答案
If you try to do the helper column as a calculated field, it will sum col1
and col2
, then multiply them together which results in a meaningless answer
这篇关于如何在我的数据透视表中添加加权平均数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!