KNOWLEDGE BASE

Calculating the Year Over Year Difference of the Percent Of Total


Published: 09 Mar 2016
Last Modified Date: 09 May 2017

Question

How to obtain the year over year difference of the percent of total of a measure.

Environment

  • Tableau Desktop

Answer

In order to achieve the desired behavior please follow the steps detailed below:

1. Use the following two options in a Calculated Field:

Name: Percent Difference
Formula:
(ZN([Percent Of Total]) - LOOKUP(ZN([Percent of Total]), -1)) / ABS(LOOKUP(ZN([Percent of Total]), -1))

OR 


Name: Absolute Difference
Formula:
(ZN([Percent Of Total]) - LOOKUP(ZN([Percent of Total]), -1))

Note: Ensure to have a Date Hierarchy to use in the Computing of the above Calculation

2. Right-click on [Absolute Difference] or [Percent Difference] and Select Edit Table Calculation

3. Select the following:

  • Compute using: [Date Field]
  • At the level: Year of [Date Field] (use Year for Year over Year, Month for Month over Month etc...)
  • Restarting: None
Did this article resolve the issue?