Forecasting in Tableau uses a technique termed as exponential smoothing. These algorithms try to find a regular pattern in measures that can be continued. You usually add a forecast to a view that contains a date field and at least one measure. However, in the absence of a date, it can create a forecast for a view that comprises a dimension with integer values in addition to at least one measure.
When there is not enough data, Tableau automatically tries to forecast at a finer temporal granularity. It then aggregates the forecast back to the granularity of the Tableau visualization. Tableau provides prediction bands that may be simulated or calculated from a closed-form equation. All models with a multiplicative component or aggregated forecasts have simulated bands, while all other models use the closed-form equations.
In the dialog box Forecast Options, you can choose the model type Tableau users for forecasting. The Automatic setting is usually optimal for most views. If you choose the option Custom, then you can specify the trend and season characteristics independently, choosing either Additive, None, or Multiplicative:
Additive models are those in which the contributions of the model components are summed, whereas multiplicative models are those in which at least some component contributions are multiplied. Multiplicative models can improve forecast quality for data where the trend or seasonality is affected by the level (magnitude) of the data:
Forecasting with Time
When you forecast with a date, there can be only one base date in the view. Part dates are supported only when they refer to the same underlying field. Dates can be on either Rows, Columns, or Marks.
Tableau supports three types of dates used for forecasting:
- Truncated dates: it refers to a particular point in history with specific temporal granularity, such as February 2017. They are usually continuous, with a green background in the view. Truncated dates are valid for forecasting.
- Date parts: it refers to a particular member of a temporal measure, like February. Each date part is denoted by a different, usually discrete field. It can be used in one of the following sets of date parts for forecasting:
- Year + quarter
- Year + month
- Year + quarter + month
- Year + week
- Custom: Month/Year, Month/Day/Year
- Exact dates: it refers to a particular point in history with maximum temporal granularity like February 1, 2012, at 14:23:45.0. Exact dates are invalid for forecasting.
How to create a forecast?
To turn on the forecast, right-click on the visualization and choose Forecast > Show Forecast, or choose Analysis > Forecast > Show Forecast.
Each of the following examples indicates the structure that supports creating a forecast.
- The field you want to forecast is present on the Rows shelf, and a continuous date field is present on the Columns shelf.
- The field you want to forecast is present on the Columns shelf, and a continuous date field is present on the Rows shelf.
- The field you want to forecast is present on the Marks card, and a continuous date or discrete date set is present on Rows, Columns, or Marks.
With forecasting on, Tableau visualizes the estimated future values of the measure, in addition to actual historical values. The estimated values are always shown by default in a lighter shade of the color used for the historical data:
Forecasting When No Date is available in the View
If a valid date is not available in the view, Tableau will look for a dimension in the view with integer values. If it finds that dimension, it will use it to forecast additional values for the view’s measures. When an integer dimension is selected to be forecast with a date, it can no longer be used to partition the data. If there is more than one integer dimension, Tableau will go in this order:
- An integer dimension available on the Columns shelf. If there are more than one such dimension, it will use the first one.
- An integer dimension available on the Rows shelf.
- An integer dimension available on the Pages shelf.
- An integer dimension available on the Marks card.
When Tableau is using an integer dimension to forecast, the Forecast Option and Forecast Description dialog boxes will automatically specify that forecasting is aggregating by periods:
Changing the Forecast Result Type
To change the forecast result type for a measure, right-click on the measured field, select Forecast Result, and then choose a result type.
The Forecast Length section decides how far into the future the forecast extends. Select any one of the following:
- Automatic: It determines the forecast length based on the data.
- Exactly: It extends the forecast for the specified number of units.
- Until: It extends the forecast to the specified point in the future.
You can use the Source Data section to specify.
- Aggregate by: It specifies the temporal granularity of the time series. Having the default value, Automatic, Tableau chooses the best granularity for estimation. This will typically match the visualization’s temporal granularity (i.e., the date dimension that the forecast is based on). However, it is sometimes also possible and desirable to estimate the forecast model at a finer granularity than the visualization when the visualization time series is too short to allow estimation.
- Ignore last: It specifies the number of periods at the end of the actual data that should be ignored while estimating the forecast model. Forecast data is also used instead of actual data for these periods. You can use this feature to trim off unreliable or partial trailing periods that could mislead the forecast. When estimation granularity specified in the Source Data section is finer than shown in the visualization, the trimmed periods are an estimation. As a result, this trailing actual visualization period may become a forecast period, an aggregate of both the actual and forecast periods of estimation granularity. In contrast, null values do not contain zeros and must be filtered to allow forecast.
- Fill in missing values with zeros: Here, if there are missing values in the measure to forecast, you can specify that Tableau fill in these missing values with zero.
The Forecast Model section determines how the forecast model is to be produced.
Use the drop-down to specify whether the Tableau selects what it decides to be the best of all models, the best of those with no seasonal component, or the model that you specify.
When you choose the option Custom, two new fields appear in the Forecast Options dialog box that you use to specify the trend and season characteristics for your model:
The choices are the same for both the fields:
- None: When you select the option None for Trend, the model does not assess the data for trend. When you select the option None for Season, the model does not assess the data for seasonality.
- Additive: Additive models are those where several independent factors’ combined effect is the sum of each factor’s isolated effects. You can also use the data in your view for additive trend, additive seasonality, or both.
- Multiplicative: Multiplicative models are those where several independent factors’ combined effect is the product of each factor’s isolated effects. You can use the data in your view for multiplicative trend, multiplicative seasonality, or both.
You can also set the prediction interval to 90, 95, or 99 percent, or enter a custom value. This value can be used in two locations:
- In the prediction bands displayed with a forecast.
- For the prediction interval options that are available as forecast result types for a measure in the view: