Add calculation to Pivot Table with data from Field with Running %s

%3CLINGO-SUB%20id%3D%22lingo-sub-1425341%22%20slang%3D%22en-US%22%3EAdd%20calculation%20to%20Pivot%20Table%20with%20data%20from%20Field%20with%20Running%20%25s%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1425341%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20PivotTable%20that%20contains%20info%20regarding%20transactions%20of%20different%20products%2C%20and%20how%20long%20each%20product%20usually%20takes%20to%20process.%20I%20have%20the%20product%20types%20as%20the%20rows%20of%20the%20table%2C%20and%20for%20the%20columns%20I%20have%20%E2%80%9CDay%20Group%2C%E2%80%9D%20or%20the%20number%20of%20days%20at%20or%20under%20which%20the%20transaction%20was%20processed.%20I%20have%20the%20dollar%20sum%20of%20the%20transactions%20as%20the%20underlying%20data%2C%20and%20since%20anything%20within%205%20days%20was%20processed%20within%2010%20days%2C%20and%20anything%20in%2010%20days%20was%20processed%20in%2014%2C%20etc.%2C%20I%20have%20chosen%20%E2%80%9CShow%20Values%20As%20%25%20Running%20Total%20in%20Day%20Group%2C%E2%80%9D%20so%20that%20the%20percentages%20accumulate%20over%20a%20product%E2%80%99s%20row.%20I%E2%80%99m%20interested%20in%20the%20difference%20in%20the%20amount%20of%20transactions%20processed%20within%20the%20first%2060%20vs.%2014%20days.%20I%E2%80%99d%20like%20to%20find%20the%20percent%20difference%20between%20these%20two%20thresholds%20for%20each%20product%2Frow%20(so%20if%2030%25%20have%20been%20processed%20in%2014%20days%20and%2090%25%20have%20in%2060%2C%20I%20want%2060%25%2C%20not%20300%25%20or%2033.3%25).%20Then%20I%E2%80%99d%20like%20to%20multiply%20that%20%25%20by%20the%20sum%20of%20all%20sales%20for%20that%20product%20(I%E2%80%99ve%20pulled%20these%20from%20a%20different%20sheet%20but%20that%20can%20change).%20The%20%25%20difference%20and%20some%20of%20the%20total%20sales%20numbers%20that%20they%E2%80%99re%20multiplied%20with%20can%20be%20seen%20in%20the%20first%20picture.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20may%20not%20use%20Calculated%20Field%20and%20Calculated%20Item%20correctly.%20Thank%20you%20for%20bearing%20with%20me.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20problem%20is%20that%20if%20I%20add%20a%20calculated%20item%20(so%20that%20I%20can%20make%20a%20formula%20subtracting%20%E2%80%9860%E2%80%99%20from%20%E2%80%9840%E2%80%99)%20into%20the%20Day%20Group%20field%2C%20it%20thinks%20that%20that%20numbers%20in%20that%20column%20are%20the%20row%E2%80%99s%20total%20accumulated%20value%2C%20so%20the%20row%E2%80%99s%20other%20numbers%20are%20divided%20by%20it%20for%20their%20own%20percentages.%20You%20can%20see%20in%20the%20second%20image%20that%20leads%20to%20problems.%20I%20believe%20this%20is%20a%20problem%20no%20matter%20how%20you%20order%20the%20columns.%20I%20understand%20the%20reason%20for%20this%20problem%20is%20that%20since%20the%20difference%20column%20is%20part%20of%20the%20Day%20Group%20Field%2C%20the%20Field%20Settings%20forces%20the%20Difference%20Column%20values%20to%20be%20part%20of%20the%20running%20%25.%20The%20column%20could%20possibly%20be%20made%20as%20its%20own%20Field%20so%20that%20I%20think%20it%20can%20have%20its%20own%20Field%20Settings%2C%20but%20then%20I%20don%E2%80%99t%20think%20it%20has%20access%20to%20the%20data%20in%20the%20Day%20Group%20Field.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECurrently%2C%20I%20have%20used%20normal%20formulas%20in%20cells%20off%20to%20the%20right%2C%20which%20you%20can%20see%20in%20the%20first%20image.%20This%20works%20with%20the%20current%20filters%2C%20but%20when%20those%20or%20anything%20else%20changes%2C%20it%20presents%20problems.%20Obviously%20it%E2%80%99d%20be%20ideal%20and%20more%20robust%20if%20I%20could%20incorporate%20this%20difference%20calculation%20directly%20into%20my%20PivotTable.%20If%20it%E2%80%99s%20also%20possible%20to%20not%20apply%20Field%20Settings%20to%20certain%20columns%20or%20Field%20Items%2C%20that%20could%20also%20work.%20Other%20things%20I%E2%80%99ve%20looked%20into%20are%20Slicers%2C%20PowerPivot%2C%20and%20other%20PivotTables.%20I%20wouldn%E2%80%99t%20immediately%20want%20to%20use%20these%20or%20another%20option%20if%20it%20wasn%E2%80%99t%20dynamic%20and%20able%20to%20change%20size%20and%20filters%20along%20with%20the%20original%20PivotTable.%20That%E2%80%99s%20the%20situation%20I%E2%80%99m%20already%20in%20with%20the%20cells%20off%20to%20the%20right.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%E2%80%99ve%20spent%20a%20ton%20of%20time%20on%20this.%20Thanks%20in%20advance%20for%20any%20help!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1425341%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1425398%22%20slang%3D%22en-US%22%3ERe%3A%20Add%20calculation%20to%20Pivot%20Table%20with%20data%20from%20Field%20with%20Running%20%25s%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1425398%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F682679%22%20target%3D%22_blank%22%3E%40jcarrigan%3C%2FA%3E%26nbsp%3B%20Did%20you%20try%20using%20GETPIVOTDATA%20formula%3F%26nbsp%3B%20you%20can%20call%20out%20multiple%20fields%20to%20pull%20out%20the%20specific%20values%20you%20want.%26nbsp%3B%20Although%20multiple%20rows%20have%20the%20same%20names%20in%20the%20first%20col%20you%20show%20I'm%20sure%20there%20is%20another%20field%20that%20differentiates%20those%20groups.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1425482%22%20slang%3D%22en-US%22%3ERe%3A%20Add%20calculation%20to%20Pivot%20Table%20with%20data%20from%20Field%20with%20Running%20%25s%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1425482%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%26nbsp%3BI%20initially%20used%20GETPIVOTDATA%20for%20the%20table%20to%20the%20right%2C%20but%20I%20switched%20it%20to%20the%20hard%20cell%20references%20since%20those%20supported%20dragging%20the%20fill%20handle%20when%20different%20filters%20yield%20a%20different%20number%20of%20rows.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1425536%22%20slang%3D%22en-US%22%3ERe%3A%20Add%20calculation%20to%20Pivot%20Table%20with%20data%20from%20Field%20with%20Running%20%25s%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1425536%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F682679%22%20target%3D%22_blank%22%3E%40jcarrigan%3C%2FA%3E%26nbsp%3BIt%20would%20be%20easier%20to%20suggest%20a%20solution%20if%20you%20could%20upload%20your%20pivot%20table%20(just%20fake%20your%20numbers%2Fproduct%20name%20for%20confidentiality)%20and%20also%20a%20Tab%20with%20a%20few%20row%20examples%20of%20what%20you%20want%20to%20finally%20achieve%2Fshow%20(i.e.%20correct%20output).%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1425548%22%20slang%3D%22en-US%22%3ERe%3A%20Add%20calculation%20to%20Pivot%20Table%20with%20data%20from%20Field%20with%20Running%20%25s%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1425548%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F675276%22%20target%3D%22_blank%22%3E%40hynguyen%3C%2FA%3E%26nbsp%3B%2C%20I'll%20get%20on%20that%20ASAP.%20I'll%20provide%20one%20soon!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

I have a PivotTable that contains info regarding transactions of different products, and how long each product usually takes to process. I have the product types as the rows of the table, and for the columns I have “Day Group,” or the number of days at or under which the transaction was processed. I have the dollar sum of the transactions as the underlying data, and since anything within 5 days was processed within 10 days, and anything in 10 days was processed in 14, etc., I have chosen “Show Values As % Running Total in Day Group,” so that the percentages accumulate over a product’s row. I’m interested in the difference in the amount of transactions processed within the first 60 vs. 14 days. I’d like to find the percent difference between these two thresholds for each product/row (so if 30% have been processed in 14 days and 90% have in 60, I want 60%, not 300% or 33.3%). Then I’d like to multiply that % by the sum of all sales for that product (I’ve pulled these from a different sheet but that can change). The % difference and some of the total sales numbers that they’re multiplied with can be seen in the first picture.

 

I may not use Calculated Field and Calculated Item correctly. Thank you for bearing with me.

 

The problem is that if I add a calculated item (so that I can make a formula subtracting ‘60’ from ‘40’) into the Day Group field, it thinks that that numbers in that column are the row’s total accumulated value, so the row’s other numbers are divided by it for their own percentages. You can see in the second image that leads to problems. I believe this is a problem no matter how you order the columns. I understand the reason for this problem is that since the difference column is part of the Day Group Field, the Field Settings forces the Difference Column values to be part of the running %. The column could possibly be made as its own Field so that I think it can have its own Field Settings, but then I don’t think it has access to the data in the Day Group Field.

 

Currently, I have used normal formulas in cells off to the right, which you can see in the first image. This works with the current filters, but when those or anything else changes, it presents problems. Obviously it’d be ideal and more robust if I could incorporate this difference calculation directly into my PivotTable. If it’s also possible to not apply Field Settings to certain columns or Field Items, that could also work. Other things I’ve looked into are Slicers, PowerPivot, Macros/VBA, and other PivotTables. I wouldn’t immediately want to use these or another option if it wasn’t dynamic and able to change size and filters along with the original PivotTable. That’s the situation I’m already in with the cells off to the right.

 

I’ve spent a ton of time on this. Thanks in advance for any help!

4 Replies
Highlighted

@jcarrigan  Did you try using GETPIVOTDATA formula?  you can call out multiple fields to pull out the specific values you want.  Although multiple rows have the same names in the first col you show I'm sure there is another field that differentiates those groups.

Highlighted

@mtarler I initially used GETPIVOTDATA for the table to the right, but I switched it to the hard cell references since those supported dragging the fill handle when different filters yield a different number of rows.

Highlighted

@jcarrigan It would be easier to suggest a solution if you could upload your pivot table (just fake your numbers/product name for confidentiality) and also a Tab with a few row examples of what you want to finally achieve/show (i.e. correct output).

Highlighted

Thanks @hynguyen , I'll get on that ASAP. I'll provide one soon!