Excel pivot table - average of calculated sums - excel

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 pivot table is showing the sums of the remaining funds per person. Now how do I get an average by person (so, manually calculated, 3300/3)?
I tried using a calculated field, but cannot figure out how it will work because the denominator will change based on how many people will have the funds I'm filtering on. If I use the averaging inside the calculated field it goes back to averaging the funds.
I tried putting the calculation outside the pivot table, and this works, but of course as I filter, my calculated field is no longer adjacent to the pivot table data, instead just floating off on the worksheet by itself.
TIA.
Per request here is the field list - if I try adding an "average of amount" to the value box it averages the fund amounts, instead of the fund amount per person. :

Here is a 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:
Select your data and click add to “data model” icon on Power Pivot tab.
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.
Add another column with formula =[amount]/[DistPersNo] name it
“PersonAverages”.
In Power Pivot window click PivotTable and add new pivot table to
your worksheet.
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.

I would add a helper column in column D to count unique customers.
Sort your data by person
In column D2 put =IF(A2=A1, 1, 0) and call the column UniqueCust
Copy formula down your dataset for all rows
Add the column to your pivot
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.

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.

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)
and Sort by Person (Note the reversed position of Fund and Person in the Row labels section)
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.

Click the pivot table to bring up the field list.
In the Values section where it says "Sum of Amount" click the drop down.
Click "Value Field Settings" and choose average from the list in the pop-up.

Related

Create a calculated pivot table column in excel based off other columns in the pivot table?

So I have a bunch of rows in a query table that shows orders from a certain timeframe and whether that order had a "defect" or not. I have started a pivot table on that table to summarize the # of orders and # of those orders that were defective by day (trying to start a p-chart).
Is there any way to create a 4th column in the pivot table that calculates the percent defective (Orders with Defects/Count of Orders) from the two existing columns?
Sure,
Based on this site, these are the steps:
To start, select any cell in the pivot table
Next, on the Excel Ribbon, go to the PivotTable Analyze tab
In the Calculations group, click Fields, Items, & Sets
Then, in the drop-down menu, click the Calculated Field command
Once there give a name to your Calculated Field and set your formula to Orders with defect / orders (tip: select the fields from the list to make sure you get the names right).
One last note: I believe calculated fields perform additions by default.. I noticed your 2nd column is a "count", I believe the calculated field will sum that column (before dividing) instead of counting it.

Is there a way to do a sum of columns in an Excel pivot table with a calculated field greyed out? (It contains distincts values fields)

I have a pivot table with distincts value. Short story it was needed for manual adjustment of quantity and also I have no access to Power Pivot.
Is there a way to sum columns inside the pivot table? I have to sort and filter by supplier and adding column with formula outside of the pivot table would not make it all follow when filter or sort.
Please see below image
Thanks!

Sum in columns, subtraction in grand totals - DAX

I would like to see the sum of data in columns and subtraction in grand totals in an Excel pivot table based on Power Pivot, e.g. in the column "Suma końcowa" I would like to see subtraction A-B instead of sum.
Thanks for help!
file
table
Here you go for a option of pivot from table of data.
The fields which you have in the tables will converted as grouped for same Column when makes pivot table.
Hence the calculated Item doesn't work. So added "Month" Column by Using Formula of =Text(value,"MMM'YY"). The created the pivot table and done manual calculation.
1.Added Month Column In Table :
2.Crating new pivot table based the Table data:
3.Pivot Table Created and Filed assigned based on required format:
4.Insert Calculated Item From analyze Tab:
5.Working on calculation Item option:
In The Insert Calculated Item View Type Name manually as
what you need the field header ex. Subs
The In The Formula Tab Type = (A-B) else double click on the
A field and the type "-" manually then double click on B
Then Click Add then the field "Subs" will be added In Pivot Table.
6."Subs" Field added in pivot and removing Grand Total From Pivot Table:
7.Final view of Pivot with "Subs" field from table of Raw Data:
Note: Please read complete and view the images to understand better
way. The adding filed
item not possible by making your own pivot style which is in your question image,
due to the Data filed is in Group option.
So need to follow the steps which i have mentioned over above.
Please let know though comments if need any more clarification.

Excel Pivot Table Cumulative Change

Basically, I have a set of data, with the following columns: date, price, daily price change and % change, the former two calculated using pivot table field list menu. I want to calculate the cumulative daily change over the period of time, in a next column. As it is a pivot table, it has absolute references and I cannot simply add previous day's change to a today's change one by one, due to a large data set. What is the most efficient way to do it? Thank you.
Go to pivot table option tab which appears when you select any cell in the pivot table range. The click on the drop down menu Option and deselect Generate GetPivotData.
After this, you can use the formulas as normal.
You can add additional column in the main sheet as "cumulative change". The new column can have the cumulative value and you can use summation formula for this.
Then you can take this value in pivot table for further analysis.
Take the help of Vlookup also.
You can follow the steps in the video below for detail pivot analysis as per your need.
https://www.youtube.com/watch?v=vzd7RUGloXM
https://www.youtube.com/watch?v=wsCxOmsMq6k

How do I create a custom grand total or calculated field in my pivot table in Excel?

I have a pivot table with various calculated fields. I want one of these calculated fields to change depending on what I choose from the slicer. In order to help understand what I'm trying to do I can provide some screenshots:
Here each row contains information for one SITA and each column is a calculated field. The Var(%) column is (ABS(OTB Occupancy - OFF Occupancy))/OTB Occupancy. The very last entry in Var(%) is calculated manually and takes the average of the column (this restricts me from filtering the pivot table as I'll have to recalculate the formula and/or move it to another cell so it stays in the position where it is the last cell).
Now my problem is I am no longer using this pivot table but I am starting to create other pivot tables which need to be more dynamic than this one. For example:
As you can see the first two entries of April in the pivot table correspond with the previous pivot table (OTB Occupancy and OFF Occupancy are the same as Sum of Act_Occ and Sum of Fct_Occ respectively). However, I need the third column to be the average given in the last entry of Var(%). (Please note that this cell isn't part of the pivot table and it's just a formula i used). But also, if I were to select two SITAs only from the slicer I'll want only the average of them two.
I'm not sure if excel can do what I want but any help is appreciated.

Resources