Solved

Calculated field with pivot columns

Posted on 2013-12-06
4
390 Views
Last Modified: 2013-12-09
I've got a worksheet that looks like this
YEAR |  ITEMNO | REVENUE
-----|---------|-----------------
2010 | number1 | $5
2010 | number1 | $6
2010 | number2 | $10
2011 | number1 | $6
2011 | number2 | $9
2011 | number2 | $6
2012 | number1 | $8
2012 | number2 | $10

Open in new window

I put it into an excel pivot table so the results look like this
ITEMNO  | 2010 |  2011 | 2012 
--------|------|-------|------
number1 | $11  |   $6  |  $8
number2 | $10  |  $15  |  $10

Open in new window

I would like to add a calculated column to the right to calculate the difference between the revenue for of the years like this
ITEMNO  | 2010 |  2011 | 2012 | 10-11 Diff | 11-12 Diff  
--------|------|-------|------|------------|------------
number1 | $11  |   $6  |  $8  |    $-5     |   $2
number2 | $10  |  $15  |  $10 |    $5      |   $-5

Open in new window

Is this something that is possible? If so, how can I do this?
0
Comment
Question by:David11011
4 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 300 total points
ID: 39702502
Add Revenue a second time as a data field in your pivot
Right-click that second revenue column and pick Show value as...Difference From
Base field: Year / Base Item: Previous
Update the column header

You're done. Sadly there's no way I know to hide the first empty column, but you can hide the column until the next pivot refresh.

Thomas
0
 
LVL 19

Expert Comment

by:helpfinder
ID: 39704581
do you mean something like that on my example?
sample.xlsx
0
 
LVL 32

Assisted Solution

by:Rob Henson
Rob Henson earned 200 total points
ID: 39705773
Something like attached.

Calculated Year on Year movement using a helper column in the data. Against each line the formula gives the same result for each combo of year and account so then displayed in the pivot as Average.

=SUMIFS($C$2:$C$9,$A$2:$A$9,$A2,$B$2:$B$9,$B2)-SUMIFS($C$2:$C$9,$A$2:$A$9,$A2-1,$B$2:$B$9,$B2)

Haven't found a way of putting Variance columns to right hand side.

Solution from helpfinder could be used, ie adding additional formula alongside the pivot but these won't necessarily recalculate correctly by having hardcoded cell references in the formula. You could do similar using GETPIVOTDATA function.

Thanks
Rob H
Pivot-Variance.xlsx
0
 
LVL 2

Author Closing Comment

by:David11011
ID: 39706171
Thank you for your replies this will work just fine for what I am wanting to do. It would be nice to put all the values to the right hand side but I this will work fine. Thank you so much for your help!!!! Exactly what I needed!
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question