Calculating the difference between two rows of pivot table data

NorthupL

New Member
Joined
Aug 27, 2012
Messages
4
I have budget data that has 5 years of planned budgets for each program line in my portfolio that I want to compare with a new 5 year budget plan. Is there a way to get a pivot table or PowerPivot to calculate the difference between the two rows of data so I can see how much the new budget changed from the previous budget? (instead of calculating a subtotal, calculate a difference)
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Not sure I understand what difference you want but try:

right click the data field column, select 'Value Field Settings...' In the resulting dialog box, select the 'Show Values As' tab then 'Difference From' and Base Item: previous.
I have budget data that has 5 years of planned budgets for each program line in my portfolio that I want to compare with a new 5 year budget plan. Is there a way to get a pivot table or PowerPivot to calculate the difference between the two rows of data so I can see how much the new budget changed from the previous budget? (instead of calculating a subtotal, calculate a difference)
 
Upvote 0
Can we see what your source data looks like? Is it in one source table or two for instance?

PowerPivot measures don't operate on the data in the pivot itself, they operate on the source tables, and then just get displayed in the pivot. So the "shape" of the source tables matters quite a bit.
 
Upvote 0
Can we see what your source data looks like? Is it in one source table or two for instance?

PowerPivot measures don't operate on the data in the pivot itself, they operate on the source tables, and then just get displayed in the pivot. So the "shape" of the source tables matters quite a bit.

Data is in two tables
as below. Need to easily calculate the difference between Old Position and New Plan for each fiscal year without having to just insert a new row and subtract the two Positions.

PositionCOMMODITY IDPROGRAM IDPROGRAM NAMEITEMAPPNBABA BLININCREMENTFY11FY12FY13FY14FY15FY16FY17FY18FY19
Orig PlanCACBRN DRSCBRN DISMOUNTED RECONNAISSANCE SYSTEMSBA4 CA4 CONTAMINATION AVOIDANCE (ACD&P)RDTEBA4BA41195300000000
Orig PlanCACBRN DRSCBRN DISMOUNTED RECONNAISSANCE SYSTEMSBA5 CA5 CONTAMINATION AVOIDANCE (SDD)RDTEBA5BA514902120290146818871111288603811100
Orig PlanCACBRN DRSCBRN DISMOUNTED RECONNAISSANCE SYSTEMSBA7 CA7 CONTAMINATION AVOIDANCE OPERATIONAL SYS DEVRDTEBA7BA71000000000
Orig PlanCACBRN DRSCBRN DISMOUNTED RECONNAISSANCE SYSTEMSP MC0101 CBRN DISMOUNTED RECONNAISSANCE SYSTEMS (CBRN DRS)PROCPGP20001125536624150803469895081958899010900

<tbody>
</tbody>

PositionCOMMODITY IDPROGRAM IDPROGRAM NAMEITEMAPPNBABA BLININCREMENTFY11FY12FY13FY14FY15FY16FY17FY18FY19
New PlanCACBRN DRSCBRN DISMOUNTED RECONNAISSANCE SYSTEMSBA4 CA4 CONTAMINATION AVOIDANCE (ACD&P)RDTEBA4BA41195300000000
New PlanCACBRN DRSCBRN DISMOUNTED RECONNAISSANCE SYSTEMSBA5 CA5 CONTAMINATION AVOIDANCE (SDD)RDTEBA5BA51490212029014681200000000
New PlanCACBRN DRSCBRN DISMOUNTED RECONNAISSANCE SYSTEMSBA7 CA7 CONTAMINATION AVOIDANCE OPERATIONAL SYS DEVRDTEBA7BA710000300050005000500011252
New PlanCACBRN DRSCBRN DISMOUNTED RECONNAISSANCE SYSTEMSP MC0101 CBRN DISMOUNTED RECONNAISSANCE SYSTEMS (CBRN DRS)PROCPGP20001125536624150803499881258982721050001203260

<tbody>
</tbody>
 
Upvote 0
What I was trying to do was instead of adding the two rows for a subtotal, get the difference between the two rows Orig Plan and New Plan as in the Pivot below.

PROGRAM NAMEBAPositionSum of FY11Sum of FY12Sum of FY13Sum of FY14Sum of FY15Sum of FY16Sum of FY17Sum of FY18
CBRN DISMOUNTED RECONNAISSANCE SYSTEMSBA4New Plan19530000000
Orig Plan19530000000
BA4 Total39060000000
BA5New Plan49021202901468120000000
Orig Plan490212029014681887111128860381110
BA5 Total9804240580293621087111128860381110
BA7New Plan00003000500050005000
Orig Plan00000000
BA7 Total00003000500050005000
PNew Plan12553662415080349988125898272105000120326
Orig Plan12553662415080346989508195889901090
P Total25106132483016069696176339194161195109120326
CBRN DISMOUNTED RECONNAISSANCE SYSTEMS Total127054538285952280567190467207764208220125326

<tbody>
</tbody>
 
Upvote 0
Consider using a SQL query (via Excel's MS Query tool).

If the 2 tables are in sheets named Orig and New, the below lists the difference for FY15.
Code:
SELECT `New$`.APPN, `New$`.BA, `New$`.FY15-`Orig$`.FY15 AS 'Diff'
FROM `C:\Temp\Book1.xls`.`New$` `New$`, `C:\Temp\Book1.xls`.`Orig$` `Orig$`
WHERE `New$`.APPN = `Orig$`.APPN AND `New$`.BA = `Orig$`.BA

For an intro to MS Query see
Building and using a relational database in Excel (with a little help from MS Query)
RDBMS in Excel

Data is in two tables
as below. Need to easily calculate the difference between Old Position and New Plan for each fiscal year without having to just insert a new row and subtract the two Positions.

PositionCOMMODITY IDPROGRAM IDPROGRAM NAMEITEMAPPNBABA BLININCREMENTFY11FY12FY13FY14FY15FY16FY17FY18FY19
Orig PlanCACBRN DRSCBRN DISMOUNTED RECONNAISSANCE SYSTEMSBA4 CA4 CONTAMINATION AVOIDANCE (ACD&P)RDTEBA4BA41195300000000
Orig PlanCACBRN DRSCBRN DISMOUNTED RECONNAISSANCE SYSTEMSBA5 CA5 CONTAMINATION AVOIDANCE (SDD)RDTEBA5BA514902120290146818871111288603811100
Orig PlanCACBRN DRSCBRN DISMOUNTED RECONNAISSANCE SYSTEMSBA7 CA7 CONTAMINATION AVOIDANCE OPERATIONAL SYS DEVRDTEBA7BA71000000000
Orig PlanCACBRN DRSCBRN DISMOUNTED RECONNAISSANCE SYSTEMSP MC0101 CBRN DISMOUNTED RECONNAISSANCE SYSTEMS (CBRN DRS)PROCPGP20001125536624150803469895081958899010900

<tbody>
</tbody>

PositionCOMMODITY IDPROGRAM IDPROGRAM NAMEITEMAPPNBABA BLININCREMENTFY11FY12FY13FY14FY15FY16FY17FY18FY19
New PlanCACBRN DRSCBRN DISMOUNTED RECONNAISSANCE SYSTEMSBA4 CA4 CONTAMINATION AVOIDANCE (ACD&P)RDTEBA4BA41195300000000
New PlanCACBRN DRSCBRN DISMOUNTED RECONNAISSANCE SYSTEMSBA5 CA5 CONTAMINATION AVOIDANCE (SDD)RDTEBA5BA51490212029014681200000000
New PlanCACBRN DRSCBRN DISMOUNTED RECONNAISSANCE SYSTEMSBA7 CA7 CONTAMINATION AVOIDANCE OPERATIONAL SYS DEVRDTEBA7BA710000300050005000500011252
New PlanCACBRN DRSCBRN DISMOUNTED RECONNAISSANCE SYSTEMSP MC0101 CBRN DISMOUNTED RECONNAISSANCE SYSTEMS (CBRN DRS)PROCPGP20001125536624150803499881258982721050001203260

<tbody>
</tbody>
 
Upvote 0
You can do this by:

1) Loading each table into the PowerPivot window
2) Rename the Orig Plan table from 'Table1' to 'Orig Plan'
3) Rename the New Plan table from 'Table2' to 'New Plan'
4) On the New Plan table, right click FY11 and click insert column
5) Use the following DAX:

=CALCULATE( VALUES('New Plan'[FY11]), FILTER( 'New Plan' , 'New Plan'[BA BLIN] = 'Orig Plan'[BA BLIN]) )

6) Rename the calculated column to 'Orig FY11'
7) Do the sme for each FY value

You will now have all values side by side and can create a simple measure (or calculated column) that substracts the 'Orig FY11' from the new 'FY11' value.

Javier Guillen
 
Upvote 0
A simple solution might be to just relate the tables on one of the unique columns and then use the RELATED funtion to pull the values from table 2 into table 1. Then you will have all your fields in table 1 and calculating the difference will be as simple as subtracting the 2 fields in a calculated column or measure.
 
Upvote 0
Thanks for all the responses. I ended up creating an additional column for each year that uses show value as diff and it works. Gives 5 additional columns instead of one row. MS Excel team should let you turn subtotal into a difference.
 
Upvote 0

Forum statistics

Threads
1,214,375
Messages
6,119,166
Members
448,870
Latest member
max_pedreira

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top