Forecast in Tableau
Time series is one of the important analysis in data world. We always want to see the forecast of our data so that we can set the goals and estimates for the future. Forecast in Tableau is a very handy feature, though not very widely used. So, in this blog I am going to discuss all about Forecast in Tableau.
Tableau uses the Exponential Smoothing Models (ESM) for the forecast. With exponential smoothing, recent observations are given relatively more weight than older observations. These models capture the evolving trend or seasonality of your data and extrapolate them into the future. The more data points that you provide to Tableau the better forecast you get. Once, the Vizql provides you the forecast, you can add seasonality, forecast length, prediction level.
Let’s go ahead and create a visualization in Tableau and then add forecast to it, to understand it in detail:
We will be using Sample Superstore data for this.
Connect Tableau to the dataset and create a left join with Order and Return. Go to sheet and take Order date- Quarter- Continuous- in Column shelf (I deal with discrete and continuous dates in the trainings).Take Sales in the Row shelf.
*Note: Tableau shows the best forecast with Date in the visualization with a Measure (like in the above screenshot). When no date dimension is present, you can add a forecast if there is a dimension field in the view that has integer values (for this please refer to my another blog- Forecast when no date in the visualization). Also, the more data you give to Tableau the better forecast it will return you.
Once the visualization showing the Quarterly Sales is ready we can add a forecast in the view by right clicking any where in the sheet and selecting Show Forecast.
And we start seeing a forecast in tableau according to ESM:
*Note: Exponential smoothing models with trend or seasonal components are effective when the measure to be forecast exhibits trend or seasonality over the period of time on which the forecast is based. Trend is a tendency in the data to increase or decrease over time. Seasonality is a repeating, predictable variation in value, such as an annual fluctuation in temperature relative to the season.
In general, the more data points you have in your time series, the better the resulting forecast will be. Having enough data is particularly important if you want to model seasonality, because the model is more complicated and requires more proof in the form of data to achieve a reasonable level of precision. On the other hand, if you forecast using data generated by two or more different DGPs, you will get a lower quality forecast because a model can only match one.
Editing/ Customizing the Forecast:
Once you have got the forecast according to the Vizql you can customize the given forecast to some extent
Once done we can also see the Forecast results:
- Actual & Forecast—Show the actual data extended by forecasted data.
- Trend—Show the forecast value with the seasonal component removed.
- Precision—Show the prediction interval distance from the forecast value for the configured confidence level.
- Precision %—Show precision as a percentage of the forecast value.
- Quality—Show the quality of the forecast, on a scale of 0 (worst) to 100 (best).
- Upper Prediction Interval—Shows the value above which the true future value will lie confidence level percent of the time assuming a high quality model.
- Lower Prediction Interval—Shows 90, 95, or 99 confidence level below the forecast value.
- Indicator—Show the string Actual for rows that were already on the worksheet when forecasting was inactive and Estimate for rows that were added when forecasting was activated.
- None—Do not show forecast data for this measure.
Constraints of forecast: Last but not the least; the constraints of forecast are: you cannot add a forecast to a view if it contains any of the following:
- Table calculations
- Disaggregated measures
- Percent calculations
- Grand Totals or Subtotals
- Date values with aggregation set to Exact Date
Use of forecast: You can create a dashboard like below: