Powerpivot Subtotals not adding up

JEB85

Board Regular
Joined
Aug 13, 2010
Messages
238
Hi,

My base data is set up as follows:

SiteProductKGVariable ContributionPeriodYear
A
1​
1,949​
5,367​
Prior PeriodCurrent Year
A
2​
2,285​
6,260​
Prior PeriodCurrent Year
A
2​
1,142​
2,952​
Current PeriodCurrent Year
A
3​
2,281​
3,258​
Prior PeriodCurrent Year
A
3​
919​
1,056​
Current PeriodCurrent Year

This has been loaded as a data table [Table 1] in to powerpivot.

My powerpivot, with measures, looks likes so:

Values
SiteProductCP KGPP KGVar in KGPP VCPP VC/KGVolume Impact
A
1​
1,948.80​
-1,948.80​
5,366.53​
2.75​
-5,366.53​
2​
1,142.40​
2,284.80​
-1,142.40​
6,260.05​
2.74​
-3,130.02​
3​
918.72​
2,280.96​
-1,362.24​
3,258.46​
1.43​
-1,946.02​
A Total
2,061.12​
6,514.56​
-4,453.44​
14,885.03​
2.28​
-10,175.61​
Grand Total
2,061.12​
6,514.56​
-4,453.44​
14,885.03​
2.28​
-10,175.61​

The measures are as follows:
CP KG = CALCULATE(SUM([KG]),Table1[Period]="Current period",Table1[Year]="Current Year")
PP KG = CALCULATE(SUM([KG]),Table1[Period]="Prior period",Table1[Year]="Current Year")
Var in KG =Table1[CP KG]-Table1[PP KG]
PP VC =CALCULATE(SUM(Table1[Variable Contribution]),Table1[Period]="Prior Period",Table1[Year]="Current Year")
PP VC/KG =Table1[PP VC]/Table1[PP KG]
Volume Impact = Table1[Var in KG]*Table1[PP VC/KG]

Everything is working as i'd expect except for the 'Volume Impact' totals which i'd expect to be -10,442.57 (the sum of -5,366.53,-3,130.02,-1,946.02) yet it's returning -10,175.61.

Can anyone tell me what i'm doing wrong in the powerpivot calc?

Thanks
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Try increasing the number of decimal places shown. I would expect that the figures being calculated are of a higher precision than those visible.
 
Upvote 0
Try increasing the number of decimal places shown. I would expect that the figures being calculated are of a higher precision than those visible.
Hi,

The variance is too big to be rounding / /driven from decimal places.

This is the base data with 4 decimal places:

SiteProductKGVariable ContributionPeriodYear
A
1​
1,948.8000​
5,366.5283​
Prior PeriodCurrent Year
A
2​
2,284.8000​
6,260.0452​
Prior PeriodCurrent Year
A
2​
1,142.4000​
2,952.0926​
Current PeriodCurrent Year
A
3​
2,280.9600​
3,258.4572​
Prior PeriodCurrent Year
A
3​
918.7200​
1,055.8990​
Current PeriodCurrent Year
 
Upvote 0
The variance is too big to be rounding / /driven from decimal places.
I disagree. Rounded to 4 decimal places the results that you were getting are correct. This is done using worksheet formulas on the same principle so that you can see where the result is coming from.
Book1
ABCDEFGH
10SiteProductCP KGPP KGVar in KGPP VCPP VC/KGVolume Impact
11A11,948.80-1,948.805,366.532.75376-5,366.53
1221,142.402,284.80-1,142.406,260.052.739866-3,130.02
133918.722,280.96-1,362.243,258.461.428546-1,946.02
14A Total2,061.126,514.56-4,453.4414,885.032.284887-10,175.61
Sheet2
Cell Formulas
RangeFormula
G11:G14G11=F11/D11
H11:H14H11=E11*G11
E11:E14E11=C11-D11
F14F14=SUM(F11:F13)
 
Upvote 0
Thanks, but i don't want the site total to calculate as an average, i'd like it to be the sum of it's parts.
So if i were doing it in regular excel, where your formula in H14 = E14 * G14, it sould be =sum(H11:H13) =-10,442.57. Is it possible to do this in powerpivot?
 
Upvote 0
As far as I know the total of a calculated column will always use the same formula as the rest of the column in the same way that I've shown above. I'll look into it but I don't believe that it can be changed.
 
Upvote 0
O
As far as I know the total of a calculated column will always use the same formula as the rest of the column in the same way that I've shown above. I'll look into it but I don't believe that it can be changed.
Ok, thanks for your help.
 
Upvote 0
You can make the Subtotals calculate differently than the individual rows...

Here is an example of a measure I have .. we assign points to each BRAND based on sales amounts...
so what it does is it says..

BrandLevelPoints:=IF(COUNTROWS(VALUES(tGroups[FOCUS]))=1,[OctPts],IF([OctChg]>0,SUMX(VALUES(tGroups[FOCUS]),[OctPts]),BLANK()))


if it is a single brand row then use my [OctPts] calculation...
if it is NOT a single Brand row.. like with a Subtotal or Grand Total .. then SUM the results of all the OctPts calculations that are part of that subtotal
 
Upvote 0
looking at your data ..it might be as simple as

Measure1:=SUMX(VALUES(Table1[Product]),[Volume Impact])
 
Upvote 0

Forum statistics

Threads
1,223,693
Messages
6,173,868
Members
452,536
Latest member
Chiz511

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