KNOWLEDGE BASE

Calculating Percent Difference Across Dimensions


Product(s): Tableau Desktop, Tableau Public
Version(s): All
Last Modified Date: 16 Aug 2016

Tableau Desktop lets you compare multiple dimensions to answer questions such as "How do Product A sales compare to Product B sales?" or "Which region is more profitable: East or 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 measure values in the entire table, and they often depend 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 Sample - Superstore data source.

Step 2 

From the Dimensions area of the Data pane, drag Region to Columns.

Step 3 

From the Measures area of the Data pane, drag Sales to Columns.

Step 4 

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

CompareDimensions2.png

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

The table calculation shows the percent difference from previous.

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 for all other regions. You can see that the sales in the South are 11.88% higher than 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 area of the Data pane, drag Sub-Category to Rows.

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 basis for comparison.

There are many different types of table calculations. Experiment with each kind to find out which one is right for answering your questions.

 

Alternate Search Terms:How To Calculations
Did this article resolve the issue?