Today’s tableau tip will talk about how to calculate moving averages and other things you might want to do with it.
Moving averages are useful for finding any trends/patterns in your data. This is especially useful when dealing with information with seasonality or with data that have lots of peaks.
A moving average calculates the overall trend for this, as it may not be easy to see it straight away with just the individual points.
This is where Tableau comes in and becomes a useful tool.
To build this view, you would need to have 2 ‘measure values’; one for the total sum of sales and the other for the moving average of the sales.
To create a view comparing several values on one axis, please see my previous blogpost here.
Once you’ve got both your ‘sum of sales’ in the same view, on one of them, right click. Select ‘Add table calculation’.
You should then see this view:
Under calculation type, select ‘moving calculation’. On the second row, just below it, select how many days/weeks/months you want to calculate the moving average by.
NOTICE! Notice that on bottom, ‘current value’ is ticked. This means that if you want to measure by 4 months, you only select ‘3’ next to ‘previous values’ as it counts the one you are currently on: 3+1=4
Next, you need to make sure you tick the right boxes.
Under ‘Compute Using’, select how you would like to calculate the moving average. If you select ‘specific dimensions’, you need to make sure you understand how to use it. Remember, the UNTICKED boxes are the ones you want to calculate the moving average for (confusing, I know)!
Then, you’re all set to go!
You can even have several moving averages in your canvas and compare them to each other, like the one below!