Excel pivot table - average of calculated sums

前端 未结 5 2052
逝去的感伤
逝去的感伤 2021-02-20 03:32

I\'m sure this is simple, but how do I get a pivot table to display an average for a calculated sum of fields? In the simplified example, I\'ve filtered out fund x1, and the pi

5条回答
  •  南笙
    南笙 (楼主)
    2021-02-20 04:19

    Here is working solution:

    Firstly you should install or enable Power Pivot. Quoting Microsoft:

    Power Pivot is an Excel add-in you can use to perform powerful data analysis and create sophisticated data models.

    https://support.office.com/en-us/article/Power-Pivot-Powerful-data-analysis-and-data-modeling-in-Excel-a9c2c6e2-cc49-4976-a7d7-40896795d045?ui=en-US&rs=en-US&ad=US

    In newer Excel versions Power Pivot is already installed and you can enable it by going to:

    File > Options > Advanced > Data > Enable Data Analysis add-ins: Power Pivot, Power View, and Power Map

    Alright, so you have Power Pivot now and you can see Power Pivot tab. Please follow the steps below:

    1. Select your data and click add to “data model” icon on Power Pivot tab.
    2. In Power Pivot window add column which will count distinct number of persons in the data. =DISTINCTCOUNT([person]) name it for example “DistPersNo”. This is crucial step – Power Pivot enables you to count unique values in selected column.
    3. Add another column with formula =[amount]/[DistPersNo] name it “PersonAverages”.
    4. In Power Pivot window click PivotTable and add new pivot table to your worksheet.
    5. In Pivot Table add 'persons' to rows and 'amount' to values. Now, if you add 'PersonAverages' to values (sum of it) and filter out fund 'x1' you will achieve desired result i.e. value of 1100.

    Hope that helps.

提交回复
热议问题