Pivot Table Calculated field only on Label/Subtotal Rows - excel

I have a calculated field in a pivot table returning the running total of my period totals (Ending balance of each period). When my period Field in entirely collapsed, it looks great, but when I expand a period to look at individual transactions the calculated field is on all of those rows as well.
I'm ideally looking to see if anyone has a purely pivot settings solution.
I've tried using VBA to clear the contents when the table is updated but run into error 1004 - use field list option to modify pivot table.
I'm currently making the range text white by finding all the required cells then Rng.font.TintAndShade = 0.
I'd also like to keep this WB ".xlsx" format so it's easier for me to send to coworkers.
Pivot Collapsed:
Pivot Expanded:
Calculated field settings:

Future solution thanks to #JosWoolley:
Enable Power Pivot
Import table into the Data Model
Use DAX formulas to generate the expected result

Related

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

Pivot Table Issue - Grouping three fields (columns) into one

I have three fields in my pivot table. Each field is connected to one column in my data sheet.
The goal is to group the 0-30 data (0-30 $ Change),and (0-30 % Change) into one field, and then a slicer with 0-30 as one of the options out of 60-90, 90-120.
Currently I have a combined Pivot Table that looks like this:
Again the goal is to make one slicer that would have the 0-30 data as one option in the slicer, the 30-60 data as one option in the slicer and so on...any help would be appreciated :)
With PIVOT functionality and some formulas my approach would be to concatenate 0-30 data with 0-30 $ Change and 0-30 % Change in one column in the source and then present it in the pivot ROWs area. Here is how it looks wiht some sample data:
The second image is how the modified source looks like with the formulas used in the top row with yellow ready to be copied down:
If questions, please do let me know.
Are you looking to 'switch out' the values fields depending on what someone selects in the Slicer? If so, check out my answer at Converting multiple variables into values with excel pivot tables or power pivot
Basically, youreate a new PivotTable from a data source that contains nothing but the options that you want to show up in the slicer. i.e. '0-30', '30-60' etc. Create a slicer for that PivotTable, and when a user clicks on it, catch the resulting PivotTable_Update event and use it to change which fields shows up in your existing master PivotTable.
See the other thread for more on how to do this.

Further Summarize Pivot Table Results (Average)

This seems like something that should be so simple, but I can't figure it out this morning. I've even had my coffee. I am returning four fields from a WebFOCUS query: SHIPWEEK, Ship Date, Part Numberand Quantity (QTY). I set up the query so that it pulls 365 days of records when the workbook opens. I have then summarized the data into a Pivot Table. The Pivot Table simply shows SHIPWEEK as a row with two VALUES: Count of QTY and Sum of QTY. This all works fine.
What I want beyond this, however, is to calculate for the range of the returned results the average weekly count and standard deviation. I can do this simply by using the AVERAGE() and STDEV() functions and pointing to the two VALUES ranges in the Pivot Table. That will work once. But I'd like to not have to manually adjust the range for these formulas each time I run the query. Theoretically, there will be the same number of weeks in 365 days of data, but that may not always be the case. If the number of rows in the Pivot Table changes, then it might skew my results.
Surely there is a way to do this in the Pivot Table itself? Pivot Table offers a "Grand Total" option, which will sum all of the records, but I don't know how to do the equivalent of "Grand Total" for average or Standard Deviation.
If not in the Pivot Table, then dynamically outside of the Pivot Table without requiring manual range updates each time?
I think (though I'm not sure) that this answers your question. In the PivotTable Builder, select the value you are trying to calculate, and click on the detail button (so in the image below, the little "i" next to the appropriate item in "values". Then select the function you want instead.

Excel pivot table - average of calculated sums

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.

Excel 2007 Pivot Tables Custom calculation?

Again I'm wrestling with Excel 2007! I have some data I'm using to generate a Pivot Table and I'd like to divide all of the data by 1000...
I know I could go in and change the original data by hand but I'd much rather have a formula in the Pivot table itself that does this for me.
Any thoughts?
ps: You guys are awesome!
Create your pivot table, then in the Pivot Table options select Formulas/Insert Calculated Field. Assuming your data field is named MonthlySum then the formulat would be =MonthlySum/1000. Change the name of the Calculated Field as desired. The newly named calculated field will now be available to add to the values in your Pivot Table. As a side note you cannot use calculated fields as row labels.

Resources