Table calculations allow you to transform your data based on values already present in your view – in other words, you can make new numbers, based on the summarised data used to map out your visualisation. This saves a lot of time and effort, as you don’t need to break up your flow by creating a calculated field to get your transformed variable. Instead, you can convert your data into something more meaningful and access deeper insights in a couple of clicks.
One of the Quick table calculation options is ‘Difference’. This allows you to calibrate the data in your view relative to a specified value (or values). This is particularly useful when working with time-series data (although can also be applied to categorical data). For instance, if you want to track the performance of your business through the year, rather than simply plotting the raw values, it might be clearer to perceive monthly profits relative to your first month’s profits. Alternatively, looking at profits in each month relative to the previous month, could be useful for teasing out patterns of consistent growth or contraction.
Difference table calculations are bound to save you a lot of hassle when conducting these sort of standard business analytics operations.
‘Difference’ comes with 4 options, that allow you to specify what you are calculating difference relative to:
First – recalculate all values in the view relative to the first value in the time series
Last – recalculate all values in the view relative to the last value in the time series
Previous – recalculate each value as a difference from previous value in time series
Next – recalculate each value as a difference from next value in time series
I have illustrated the outputs of each on Superstores data in the figure below.
The top panel shows the absolute quantity of items ordered across weeks, and the 4 panels below it show the various Difference calculations.
The green and red indicate positive and negative values respectively.
Notice how the ‘Relative to First’ and ‘Last’ both retain the signal of the broader patterns evident in the absolute figures. This is because each value is calibrated relative to a single fixed point – either at the start or end of the time series.
There are very few red negative values in the ‘Relative to First’ plot, as values in subsequent weeks rarely dip below the first week’s quantity.
The ‘Next/Previous’ charts however appear a lot noisier as each value is calibrated against a neighbouring value, and quantity does not increase/decrease consistently across weeks.
Hopefully this brief intro to ‘Differences’ will give you an idea of the capabilities and potential use cases of this neat little feature in Tableau.