Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Subtract two columns in a pivot table

I have made a pivot table where i need to subtract the two scenarios Budget and Actual to be displayed in a Remaining column.

I have tried to add an expression (which works in my straight tables) but that results in two columns below budget and two below actual. I have also tried to 'Add a calculated dimmension' but that gives me an error. 

ProjectActvityScenario:BudgetActualRemaining
Project 1Activity 13010
Activity 24030
Activity 31015
TOTAL7055
Project 2Activity 155
Activity 22520
Activity 33030
TOTAL6055
TOTAL130110

Any suggestions?

Thanks!

1 Solution

Accepted Solutions
SunilChauhan
Champion II

in first expression

sum( if(Scenario ='Budget' ,Amount))  fro Budget

in second expression

sum( if(Scenario ='Actuals',Amount)) for Actual

in third expression

sum( if(Scenario ='Budget' ,Amount)) - sum( if(Scenario ='Actuals',Amount))

or if want like

Budget | Actuals | Remaining

in same expression

sum( if(Scenario ='Budget' ,Amount)) &'|'&sum( if(Scenario ='Actuals',Amount)) &'|' &

sum( if(Scenario ='Budget' ,Amount)) - sum( if(Scenario ='Actuals',Amount))

Sunil Chauhan

View solution in original post

8 Replies
Sokkorn
Master

Hi,

In Remaining expression use this formular = [Budget] - [Actual]

Regards,

Sokkorn

Not applicable
Author

When I use the expression:

sum({<Scenario={'Budget'},Amount>}Amount)-sum({<Scenario={'Actuals'},Amount>}Amount)

it creates two columns below Budget and two below Actuals (it doesn't appear like i wish when i drag and drop it somewhere else). Something wrong with my formula?

SunilChauhan
Champion II

column(budgetexpressionno)-column(actualexpressionno)

where expressionno is recognizes like below

for first top expression->column(1)

for second-> column(2)

;;;

so on

Sunil Chauhan
Not applicable
Author

Back in business!

Sunil,
I have only got 1 expression: if(Scenario ='Budget' or Scenario ='Actuals' ,sum(Amount))

which displays one column with budget and one with actuals.

Is it possible to use COLUMN? Any other way to do it?

SunilChauhan
Champion II

no its not possible

but  You can write like below to substract

sum( if(Scenario ='Budget' ,Amount))

-

sum( if(Scenario ='Actuals',Amount))

Sunil Chauhan
Not applicable
Author

If i use:

sum( if(Scenario ='Budget' ,Amount)) - sum( if(Scenario ='Actuals',Amount))

I end up with 4 columns:

Budget | Budget - 0| Actuals | 0 - Actuals

when I want:

Budget | Actuals | Remaining

Hmmm.....

SunilChauhan
Champion II

in first expression

sum( if(Scenario ='Budget' ,Amount))  fro Budget

in second expression

sum( if(Scenario ='Actuals',Amount)) for Actual

in third expression

sum( if(Scenario ='Budget' ,Amount)) - sum( if(Scenario ='Actuals',Amount))

or if want like

Budget | Actuals | Remaining

in same expression

sum( if(Scenario ='Budget' ,Amount)) &'|'&sum( if(Scenario ='Actuals',Amount)) &'|' &

sum( if(Scenario ='Budget' ,Amount)) - sum( if(Scenario ='Actuals',Amount))

Sunil Chauhan
Not applicable
Author

Thanks Sunil! You have been very helpful and patient!