Question

What I am trying to do seems to be very easy, but I can´t figure out yet how to do it.

Supposing that I have the following dataset:

enter image description here

All I want is to see the sum of old sells and new sells, plus the percentage of difference. It would be:

enter image description here

But it seems that I can´t insert this % column in the pivot table.

If I put the data like this, I wouldn't have the % column.

enter image description here

So I was wondering if I can use the VALUE field twice, but for the first one tell it to only sum the values that are of type "Old" and for the second one only values that are of type "New"?

enter image description here

I didn't find anything in field options about criteria so I don't know if it's possible.

Oh, and I tried with Calculated Fields, something like:

=IF(OldNew = "Old", Value , 0) <-- For Old Values Sum.
=IF(OldNew = "New", Value , 0) <-- For New Values Sum.

But it didn't work either.

Thank you!

Was it helpful?

Solution

Please try adding a Calculated Item named % with Formula:

=New/Old  

and formatting to suit.

OTHER TIPS

In the source data I created two new columns:

newdata2 Column OldValue formula:

=IF($B2="Old",$C2,0)

Column NewValue formula:

=IF($B2="New",$C2,0)

I then created pivot table, summing OldValue, NewValue, and a calculated field I defined as being NewValue / OldValue

enter image description here

Result (after cleaning up column titles)

enter image description here

Ken answer is right. (+ : just one pivotTable ; - : is original data coming from SQL or somehting like this, making it "impossible" to alter easily ?)

But you may also...

  • use "Getpivotdata" to make a "beautiful" table that will READ the pivotTable and calculate on the third column. (+ : you can make it just look as you want it... ; - : when a new "Name" appears, you have to add it quite manually)

  • Add a new column NEAR the pivotTable, watching out for "getpivotData" being made automatically, that will do the percentage easily. (+ : easy to maintain ; - : not very easy to read, since out of the table)

exemples

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top