Sign in or start a free trial to avail of this feature.
2. Forecasting in Tableau
Tableau has an excellent forecasting tool that can help predict the future values of time-series data. In this lesson, we will perform a forecast for future monthly sales of pharmaceutical products.
Forecasting in Tableau
- Uses historic data to predict future values
- Provides two different prediction metrics
---- Actual: Single line that represents forecast
---- Estimate: Shaded area that represents a prediction interval
- Represent a level of confidence that the prediction is within a range
- This level of confidence can be adjusted in the forecast dialog box
- The higher the level of confidence required, the wider the prediction interval
- Seasonality adjusts for seasonal changes in historic data
- Almost all markets and products are affected by seasonality
- If in doubt, I would advise including seasonality in all forecasts
In this lesson, we're going to use another modeling option in Tableau called forecast. Forecast uses historic data to predict future values in the weeks and months ahead. When you want to run a forecast, in the view you'll need a date field and a measure. Once you have both of these, you can run a forecast by simply dragging onto the view. And when you do this, you get a blue line that indicates the actual forecast, and when I hover, I can see the forecast amounts for each month, and I also get a light blue area, which is a prediction interval. And by default, this prediction interval is a 95% interval, and so Tableau is 95% confident that the correct prediction exists within this range.
To change the prediction interval, we can right-click, got to forecast, and forecast options. And this gives me a dropdown option where I can set the prediction interval to a lower degree of accuracy, what narrows the band because Tableau is now more confident, it can predict with a 90% confidence level, or I can demand a higher degree of accuracy, and so Tableau responds by widening the prediction band. Let's set this back at 95% for now.
In addition to changing the prediction interval, I can change the forecast length, I can change the level of aggregation, and I can also change the forecast model. In the model, I can set it simply to automatic, and in automatic, Tableau uses the data to calculate if the model should be additive or multiplicative, and it also adds seasonality.
Let's look at these two aspects of prediction separately. An additive model is one in which the contribution of the model components are summed, whereas a multiplicative model is one in which the component contributions are multiplied. I like to let Tableau tell me which one is correct, and so I simply set the forecast model to automatic. Separately, I can add or remove seasonality.
If you choose to include seasonality, which I recommend, it means that Tableau will take into account seasonal trends when completing its forecast. For example, if you're measuring toy sales, you should see a spike every December at Christmastime that will lean out of kilter with other months. And if seasonality is selected, then Tableau will take this into account. However, if you want to remove seasonality, you can do so with this option.
Typically, I'll simply set the forecast model to automatic.
And now I'll press OK.
To remove a prediction or a forecast, simply right-click and unclick show forecast.
And I can simply add the forecast again by dragging onto the view.
As you can imagine, there are some complicated maths behind forecasting in Tableau, and if you're interested in learning more about how Tableau creates a forecast, I'll include a link in the show notes that will be of benefit. In the meantime, it's always worth running a quick forecast when you have time series data to see what Tableau thinks your future will look like.