Excel pivot table - average of calculated sums

前端 未结 5 1983
逝去的感伤
逝去的感伤 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:16

    I would add a helper column in column D to count unique customers.

    1. Sort your data by person
    2. In column D2 put =IF(A2=A1, 1, 0) and call the column UniqueCust
    3. Copy formula down your dataset for all rows
    4. Add the column to your pivot
    5. Create a formula in your pivot table called Avg per Cust =Value/UniqueCust

    This will flag each row in your data with a 1 if it is the first time a name appears in the column or zero otherwise. The pivot table calculation will sum up the total value and divide by the total unique customers.

    0 讨论(0)
  • 2021-02-20 04:17

    Since you didn't mention how you are using the data, I will give a couple of options that could work.

    If you are the only user of the data or if someone else using the data is pivot table savvy you can use the following field list setups to switch data usage:

    Sort by Fund (Note the Fund and Person in the Row labels section)

    enter image description here

    and Sort by Person (Note the reversed position of Fund and Person in the Row labels section)

    enter image description here

    To simplify the data, you can always minimize the main fields.

    If you are distributing the pivot table to other people who aren't able or willing to modify the pivot table data, I would recommend setting up two separate pivot tables (using the same data source) with the same setups that I showed above.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-02-20 04:25

    I'm assuming that you want the value to come in any pivot table and not in a cell calculated outside the pivot table as a formula.

    As a workaround you can use another pivot table, which takes the input as the original pivot table to find the average.

    pivot tables

    The second pivot table has data source as- E3:F5 or till whatever row you require.

    You'll have to refresh all so that the second pivot table reflects any changes in the filter of first pivot table.

    I've hidden (or you can filter it out) the grand total in the first pivot table so that the average gives the average of the sum of the amounts.

    0 讨论(0)
  • 2021-02-20 04:30
    1. Click the pivot table to bring up the field list.
    2. In the Values section where it says "Sum of Amount" click the drop down.
    3. Click "Value Field Settings" and choose average from the list in the pop-up.

    0 讨论(0)
提交回复
热议问题