calculated field in pivot table.

Tripleseas

Board Regular
Joined
Jul 12, 2022
Messages
87
Office Version
  1. 2013
Platform
  1. Windows
Hello community,

I have a data set of sales transactions for each year as shown ine the table below :
I want to calculate the variation for each product. I have created a pivot table but i can't add a calculated field for this variation because i have just one column ( number of transactions )

so i added the variation manually outside of the pivot table but that's not ideal for me. is there any solution to this please.

in the calculated field ideally i will have : = number of transaction in the year 2022 - number of transactions in the year 2021.

hope i was clear thank you


Classeur1
ABCDEFGHI
1yearmoisPRODUITSCodeAgenceNumber of transactionVolume of transactions
22021JanuaryX11001X2248230,54
32022JanuaryX11001X221251,12
42021JanuaryX11001X2227065,95
52022JanuaryX11001X2200
62021JanuaryX11002X2235025,62
72022JanuaryX11002X2200
82021FebruaryX11002X2231522,28
92022FebruaryX11002X2200
102021FebruaryX21002X2224307,4
112022FebruaryX21002X3300
122021FebruaryX21002X33513396,13
132022FebruaryX21003X3300
142021FebruaryX21003X33618784,29
152022FebruaryX21003X3300
162021FebruaryX21003X3345486,89
17
18
19
20yearValeurs
2120212022
22CodeAgenceSomme de Number of transactionSomme de Volume of transactionsSomme de Number of transactionSomme de Volume of transactionsVariation NumberVariation volume
231001X22615296,491251,12-5-15045,37
241002X22810855,300-8-10855,3
25X33513396,1300-5-13396,13
261003X331024271,1800-10-24271,18
Feuil1
Cell Formulas
RangeFormula
H23:I26H23=F23-D23
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi T,

Instead of Calc Field use show Values As.

Book2
ABCDEFGHIJ
1
2
3yearValues
420212022
5CodeAgenceNo of transactionVol of transactionsVar No of TransVar VolNo of transactionVol of transactionsVar No of TransVar Vol
61001615296.491251.12-5-15045.37
7X22615296.491251.12-5-15045.37
810021324251.4300-13-24251.43
9X22810855.300-8-10855.3
10X33513396.1300-5-13396.13
1110031024271.1800-10-24271.18
12X331024271.1800-10-24271.18
13Grand Total2963819.11251.12-28-63567.98
14
15
Sheet4


1668520067049.png




Drag Number of Transactions and Volume of Transactions twice (each) in the Values Area
1 - In value field settings for 2nd No of Transactions, write the Title (Name Var no Of Trans)
2 - Select Show Values As
3 - Select Difference From
4 - Base Field Year, Base Item 2021

1668520390179.png


Repeat for 2nd Vol of Transaction


You can hide columns E & F
 
Upvote 0
Hi T,

Instead of Calc Field use show Values As.

Book2
ABCDEFGHIJ
1
2
3yearValues
420212022
5CodeAgenceNo of transactionVol of transactionsVar No of TransVar VolNo of transactionVol of transactionsVar No of TransVar Vol
61001615296.491251.12-5-15045.37
7X22615296.491251.12-5-15045.37
810021324251.4300-13-24251.43
9X22810855.300-8-10855.3
10X33513396.1300-5-13396.13
1110031024271.1800-10-24271.18
12X331024271.1800-10-24271.18
13Grand Total2963819.11251.12-28-63567.98
14
15
Sheet4


View attachment 78725



Drag Number of Transactions and Volume of Transactions twice (each) in the Values Area
1 - In value field settings for 2nd No of Transactions, write the Title (Name Var no Of Trans)
2 - Select Show Values As
3 - Select Difference From
4 - Base Field Year, Base Item 2021

View attachment 78727

Repeat for 2nd Vol of Transaction


You can hide columns E & F
All I can say is thank you so much for this amazing trick. it has worked for me.
your help is much appreciated. have a good day .
 
Upvote 0
Hi T,

Instead of Calc Field use show Values As.

Book2
ABCDEFGHIJ
1
2
3yearValues
420212022
5CodeAgenceNo of transactionVol of transactionsVar No of TransVar VolNo of transactionVol of transactionsVar No of TransVar Vol
61001615296.491251.12-5-15045.37
7X22615296.491251.12-5-15045.37
810021324251.4300-13-24251.43
9X22810855.300-8-10855.3
10X33513396.1300-5-13396.13
1110031024271.1800-10-24271.18
12X331024271.1800-10-24271.18
13Grand Total2963819.11251.12-28-63567.98
14
15
Sheet4


View attachment 78725



Drag Number of Transactions and Volume of Transactions twice (each) in the Values Area
1 - In value field settings for 2nd No of Transactions, write the Title (Name Var no Of Trans)
2 - Select Show Values As
3 - Select Difference From
4 - Base Field Year, Base Item 2021

View attachment 78727

Repeat for 2nd Vol of Transaction


You can hide columns E & F
Just one quick question please : I want to sort the variation of volume from the biggest to the smallest but that dont seem to work for me. is that possible. thanks
 
Upvote 0
Right click on label (Var Vol), sort. It does sort for each code.
 
Upvote 0
Right click on label (Var Vol), sort. It does sort for each code.
hello again,
i want to thank you for the method you showed me before i'm working with it just fine. However, if you may let me pose this question :
I want to sort the variation volume field from smallest to biggest but i just can't seem to get it to work.
when i sort it just sort the volume column and not the show value as field. and this is so important to me because in matter of fact i'm hiding all other columns just the variation that is being shown. and people using the pivot table need to see the variation from smallest to biggest. i tried to explain below :

variation.xlsx
ABCDEFGHIJKL
1
2
3AnnéeValeurs
420222023
5CodeNumberVolumeVariation VolumeVariation NumberNumberVolumeVariation VolumeVariation NumberRESULT WANTED
610102,6045,757,08600-2,604-5,757,086-5,757,086
799997,1487,687,8938,6399,179,0291,4911,491,137-2,239,470
890029,5568,355,9667,9356,116,496-1,621-2,239,4701,491,137
9900018,775129,516,44336,132173,285,05817,35743,768,61543,768,615
1099000060,633131,437,28960,633131,437,289131,437,289
11
12
13
14
15
Feuil2


thank you for your help
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,392
Members
449,081
Latest member
JAMES KECULAH

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