数据透视表中的复杂数据处理(平均值)

Complex data processing in pivot tables (averages)

我正在绘制产品的收益率。我有两种对产品进行分类的方法,假设这两种方法首先是数字:1、2、3、4 等,然后是字母 a、b、c、d、e 等。字母是数字的子类别。所以在产品中,我在各个数字组中有许多不同的字母:

1: a, b, c, e

2: c, d

3: 一个

对于每种产品,我都计算了产量并将其绘制在一个轴心图中 table。我绘制了枢轴 table 以便 "letters" 是列标签中 "numbers" 的子类别,请参见下图(请注意,在图片中子类别使用数字也是如此,"letters" 子类别只是试图在这个问题中用更多的对比来解释)

一切都很好,但我想在 "numbers" 总括类别中找到所有内容的平均值。但是,该任务还有最后一个问题需要考虑:对平均产量有贡献的产品数量可能因字母子类别而异。即:

1 - a:2 个产品中有 2 个产出 = 1(部分产出)

1 - b:22 种产品中的 2 种产量 = 0.09(部分产量)

这会导致使用数据透视表 tables 时出现问题。使用上述收益率分数,如果我使用枢轴 tables 的 "average of yield" 计算所有“1”组的总收益率,它将计算:

1 + 0.09 / 2 .... = 0.54(分数收益率)

但是我们可以看到这不是收益率的真实表示,它应该是:

(2 + 2) / (2 + 22) =

4 / 24 =

0.17(分数收益率)

谁能想出一种方法来计算使用主元 tables 而不是平均数的平均值的真实收益率?

我明白了!

我去了这里:https://support.office.com/en-nz/article/Calculate-values-in-a-PivotTable-report-697406b6-ee20-4a39-acea-8128b5e904b8

并改编了这一部分:

Create a formula in a PivotTable report
Add a calculated field        
1. Click the PivotTable report.
2. On the Options tab, in the Tools group, click Formulas, and then click Calculated Field.
3. In the Name box, type a name for the field.
4. In the Formula box, enter the formula for the field.
5. To use the data from another field in the formula, click the field in the Fields box, and then click Insert Field. For example, to calculate a 15% commission on each value in the Sales field, you could enter = Sales * 15%.
6. Click Add.

通过执行以下操作以适合我的 Excel 2010 副本:

Create a formula in a PivotTable report
Add a calculated field        
1. Click the PivotTable report.
2. On the Options tab, in the Calculations group, click "Fields, Items, and Sets", and then click Calculated Field.
4. In the Name box, type a name for the field.
5. In the Formula box, enter the formula for the field (=Yielded/Total).
6. To use the data from another field in the formula, click the field in the Fields box, and then click Insert Field. For example, to calculate a 15% commission on each value in the Sales field, you could enter = Sales * 15%.
7. Click Add.

这给出了您正在寻找的正确答案。