Create calculated field for pivot table, subtracting 2 following Qtrs

AmitM

Board Regular
Joined
Feb 4, 2015
Messages
53
hi all,

This is the SQL data I imported into power pivot:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]ProfitCenter_Name[/TD]
[TD]Account_Group[/TD]
[TD]Project_Group[/TD]
[TD]Fiscal_Year[/TD]
[TD]Q_FY[/TD]
[TD]Edition[/TD]
[TD]Edition_Type[/TD]
[TD]Revenue[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]AA[/TD]
[TD]AAA[/TD]
[TD]2018[/TD]
[TD]Q4/18[/TD]
[TD]Actual[/TD]
[TD]Internal[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]BB[/TD]
[TD]BBB[/TD]
[TD]2019[/TD]
[TD]Q1/19[/TD]
[TD]Actual[/TD]
[TD]Internal[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]CC[/TD]
[TD]CCC[/TD]
[TD]2018[/TD]
[TD]Q3/19[/TD]
[TD]Other[/TD]
[TD]External[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]AA[/TD]
[TD]AAA[/TD]
[TD]2019[/TD]
[TD]Q1/19[/TD]
[TD]Actual[/TD]
[TD]Internal[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]AA[/TD]
[TD]AAA[/TD]
[TD]2019[/TD]
[TD]Q2/19[/TD]
[TD]Actual[/TD]
[TD]Internal[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]BB[/TD]
[TD]BBB[/TD]
[TD]2019[/TD]
[TD]Q2/19[/TD]
[TD]Actual[/TD]
[TD]Internal[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]...[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I want to be able to add columns to a pivot table that will show what is the difference between one Qtr to the next one (i.e. next qtr-previous qtr), while applying this calculation on identical items (i.e. ProfitCenter_Name & Account_Group & Project_Group), having filters applied (such as: Edition, Edition_Type).

Example:
My desired pivot table will show the following:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]2018[/TD]
[TD]2019[/TD]
[TD]2019[/TD]
[TD]2019[/TD]
[TD]2019[/TD]
[/TR]
[TR]
[TD]ProfitCenter_Name[/TD]
[TD]Account_Group[/TD]
[TD]Project_Group[/TD]
[TD]Q4[/TD]
[TD]Q1[/TD]
[TD]Q2[/TD]
[TD]Q3[/TD]
[TD]Q4[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]AA[/TD]
[TD]AAA[/TD]
[TD]3[/TD]
[TD]-4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]BB[/TD]
[TD]BBB[/TD]
[TD][/TD]
[TD]-6[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]...[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

by using the above relevant data, as shown below:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[/TR]
[TR]
[TD]ProfitCenter_Name[/TD]
[TD]Account_Group[/TD]
[TD]Project_Group[/TD]
[TD]Fiscal_Year[/TD]
[TD]Q_FY[/TD]
[TD]Edition[/TD]
[TD]Edition_Type[/TD]
[TD]Revenue[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]AA[/TD]
[TD]AAA[/TD]
[TD]2018[/TD]
[TD]Q4/18[/TD]
[TD]Actual[/TD]
[TD]Internal[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]AA[/TD]
[TD]AAA[/TD]
[TD]2019[/TD]
[TD]Q1/19[/TD]
[TD]Actual[/TD]
[TD]Internal[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]AA[/TD]
[TD]AAA[/TD]
[TD]2019[/TD]
[TD]Q2/19[/TD]
[TD]Actual[/TD]
[TD]Internal[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]BB[/TD]
[TD]BBB[/TD]
[TD]2019[/TD]
[TD]Q1/19[/TD]
[TD]Actual[/TD]
[TD]Internal[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]BB[/TD]
[TD]BBB[/TD]
[TD]2019[/TD]
[TD]Q2/19[/TD]
[TD]Actual[/TD]
[TD]Internal[/TD]
[TD]3[/TD]
[/TR]
</tbody>[/TABLE]
(With data being filtered using slicers) to display only Edition=Actual & Edition_Type=Internal)


Thanks!!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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