【问题标题】:Complex data processing in pivot tables (averages)数据透视表中的复杂数据处理(平均值)
【发布时间】:2015-06-26 14:36:17
【问题描述】:

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

1: a, b, c, e

2: c, d

3: 一个

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

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

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(部分收益率)

谁能想出用数据透视表而不是平均值计算真实收益率的方法?

【问题讨论】:

    标签: excel pivot-table data-processing


    【解决方案1】:

    我明白了!

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-05
      • 2021-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多