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

我正在绘制产品的收益率。 我有两种分类产品的方式,可以说这两种方式首先是数字:1,2,3,4等,然后是字母,a,b,c,d,e等。 这些字母是数字的一个子类别。 所以在产品中,我在个别号码组中有许多不同的字母:

1:a,b,c,e

2:c,d

3:a

对于每个产品,我已经计算了产量并将其绘制在数据透视表中。 我已经绘制了数据透视表,以便“字母”是列标签中“数字”的子类别,请参阅下面的图片(请注意,在图片中,子类别也使用数字标注,“字母”子类别只是试图解释与这个问题更多的对比)

这个例子可以在这里看到

这一切都很好,但我希望find“数字”范围内的所有内容。 然而,要完成这个任务还有一个最后的问题需要考虑:每个字母子类别中产生平均产量的产品数量可能不同。 即:

1 – a:2个产品中的2个产品= 1(分数产量)

1-b:22个产物中的2个产物= 0.09(分馏率)

这在使用数据透视表时会导致问题。 使用上述收益率分数,如果我使用数据透视表的“平均收益率”来计算所有“1”组的总收益率,则计算:

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

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

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

4/24 =

0.17(分数收率)

任何人都可以用数据透视表来计算真实的收益率,而不是平均值吗?

我知道了!

我去了这里: 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. 

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