2 Replies Latest reply on Jul 26, 2018 3:00 AM by Naveen B

# Calculation wrong

Hei there,

i have a Problem with a Calculation:

I have two different countries: Russia and India (see Workbook)

the difference between Plan and Target should be displayed with a Calculation (Calculation: %)

The values for Russia (-0,01639) and India (-0,003040) are correct. However, I added a Parameter with a new Value ("All countries"). For "All countries",

Tableau is just adding the difference from Russia and India

Tableau says: - 0,01943  (= -0,01639 + -0,003040)

However the right calculation should be: ((305[Target Russia]+329[Target India]) - (310[Plan Russia] + 330 [Plan India]))/(305+329) = -0,00946.
Can anyone help?
Best regards
Anton
• ###### 1. Re: Calculation wrong

Anton,

You need to aggregate first in your formula

1 of 1 people found this helpful
• ###### 2. Re: Calculation wrong

Hi Anton ,

% Calculation what you have written execute at row level consider an example

Country     Plan     Actual     %

A               20          40          0.12

A               56          5123      1.3

B               45          67          0.95

as Per your calculation what will happen it will add all the % Row wise which is 0.12+1.3+0.95 because you are not aggregating the

in order achieve your output you need to aggregate the data at dimension level so change the calculation as like below

So it will group the values using sum first and then add the %

Country               Plan               Target               %

India                    330                    329               (305-329)//305=-0.0304

Russia                310                    305               (305-310)/305=-1.6393

All                        640                    634               634-640/634=-0.9464

Hope this helps kindly mark this answer as correct or helpful so that it will help others

BR,

NB

1 of 1 people found this helpful