Thursday, March 7, 2013

[TABLEAU] Calculating Percent Difference Across Dimensions





Calculating Percent Difference Across Dimensions

Tableau Desktop lets you compare multiple dimensions to answer questions such as, "How do Product A sales compare to Product B sales?" and "Which region is more profitable: the East or the West?" These comparisons can be answered with simple bar and line charts. However, you may want to ask more complex questions, such as "What is the rate of change in sales from last year to this year?" You can make these more complex comparisons using Table Calculations. Table Calculations are computations you apply to the values in the entire table, and they are often dependent on the table structure itself.


Add a Table Calculation

Create a view with the first dimension you want to compare and a measure.

Step 1
Open a new workbook and connect to the Superstore sample.


Step 2
From the Dimensions pane, drag Region to the Columns shelf.


Step 3
From the Measures pane, drag Sales to the Columns shelf.






Step 4
On the Columns shelf, right-click Sales and select Quick Table Calculation > Percent Difference.




This table calculation computes the percent difference between each region. By default, the difference is computed from the previous member in the table. For example, Sales in the South are 29.8% higher than Sales in the East Region, and Sales in the East Region are 13.82% lower than Sales in the Central Region.






Step 5
Right-click Sales again and select Edit Table Calculation.


Step 6
In the Table Calculation dialog box, in the Display the current value as a percentage of list, select First.




Now the view shows the percent difference from the Central Region. You can see that the sales in the South are 11.88% higher than sales in the Central region.
 






Add more Dimensions

Now consider a more complex comparison in which you want to see how products have sold in each region.

Step 1
From the Dimensions pane, drag Product 2 - Sub-Category to the Rows shelf.



You can see the percent difference from sales in the Central region for each product. The Central region shows zero values because it is the "First" value that all other regions are compared to.


Step 2
Select the West Region column and drag it to the left of the Central Region column.

 

Now the West Region is used as the comparison point.












1 comment: