2 Replies Latest reply on Feb 28, 2013 4:28 PM by Tracy Rodgers

# Percentage change - Calculation

I have a table that looks like this:

Date                  Order Type              Sales

2/1/2012                A1                         1245.25

2/1/2012                A1                         45.25

2/1/2012                A1                         55.50

2/1/2012                A1                         6.25

2/1/2012                A1                         45.33

2/1/2012                A1                         87.25

2/1/2012                A1                         77.12

2/1/2013                A1                         234.25

2/1/2013                A1                         11.25

2/1/2013                A1                         765.50

2/1/2013                A1                         12.25

2/1/2013                A1                         145.33

2/1/2013                A1                         937.25

etc...

I want to add two new columns to the Tableau worksheet below.

One would be Change in dollars from 2012 to 2013 and the Second

would be Percentage Change from 2012 to 2013.  I believe this can

be done with a Calculation Fields.   But how can you sum for Order

Type and Year?  What would the calculation look like.  Hope that is

clearer than it sounds when I read it back.  Thanks

• ###### 1. Re: Percentage change - Calculation

Hello Robert,

I used the following:

Dollar difference:  sum([Sales])-lookup(sum([Sales]), -1)

Percentage difference:  (sum([Sales])-lookup(sum([Sales]), -1))/lookup(sum([Sales]), -1)

Output:

Sample file as attached. Hope it helps.

• ###### 2. Re: Percentage change - Calculation

Hi Robert,

In addition to Ey's solution, a number of calculated fields can also be created and placed on the view. I've attached the workbook showing this. Let me know if you have any questions.

-Tracy