How to Conduct Tableau Predictive Analysis Functions in Time Series Visualizations

Predictive analytics is a powerful tool that transforms raw data into actionable insights, enabling data-driven decision-making. With Tableau’s predictive modeling functions, you can extend time axes, forecast trends, and identify future opportunities. This article walks you through creating predictions in Tableau and explores how to choose the right predictive model for your analysis.


Getting Started: Building Predictions in Tableau

Predictive modeling in Tableau involves creating visualizations, crafting prediction calculations, and extending date ranges for future insights. Here’s a step-by-step guide:

Step 1: Create a Visualization

  • Connect to your data source (e.g., Tableau’s Sample – Superstore dataset).
  • Drag the Order Date dimension to the Columns shelf and change its granularity to Month and Year.
  • Add Profit to the Rows shelf to display historical trends.

Step 2: Add Predictive Calculations

Predictive calculations use Tableau’s MODEL_QUANTILE or MODEL_PERCENTILE functions to forecast values based on historical patterns. For example:

MODEL_QUANTILE(0.5, SUM([Profit]), ATTR(DATETRUNC('month', [Order Date])))

This calculates the median predicted profit for each month. Add this calculation to the Rows shelf alongside the profit metric to visualize predictions.

Make sure you choose Dual Axis and Synchronize Axis to to align the two axes in a dual axes chart to use the same scale.

Step 3: Extend the Time Axis

To forecast into the future:

  1. Right-click the MONTH(Order Date) pill and select Extend Date Range.
  2. Specify the number of months (e.g., 1 Year) to project into the future.

Tableau uses data densification to generate marks for future dates. While actual data points stop at the latest date in your dataset, predictive models fill in the gaps with forecasted values.


Choosing the Right Predictive Model

Tableau supports three types of predictive models, each suited to specific use cases:

1. Linear Regression (Default)

Linear regression is best for cases with a single predictor or when predictors have a linear relationship with the target variable.

Example: Predicting sales based on time.

MODEL_QUANTILE(
"model=linear",
0.5,
SUM([Sales]),
ATTR(DATETRUNC('month', [Order Date]))
)

Use Case:

  • Ideal for simple, straightforward relationships.
  • Avoid when predictors are multicollinear (i.e., correlated with each other).

2. Regularized Linear Regression

Regularized linear regression is designed for scenarios with multiple predictors that may be influenced by underlying trends or multicollinearity.

Example: Predicting sales using multiple metrics.

MODEL_QUANTILE(
"model=rl",
0.5,
SUM([Sales]),
ATTR(DATETRUNC('month', [Order Date]))
)

Use Case:

  • Suitable for complex models with interdependent variables.
  • Helps prevent overfitting by applying regularization techniques.

3. Gaussian Process Regression

Gaussian process regression is the go-to model for predictions across continuous domains like time or space. It is also ideal when the relationship between variables is nonlinear.

Example: Predicting shipping time based on order date.

MODEL_PERCENTILE(
"model=gp",
AVG([Days to Ship Actual]),
ATTR(DATETRUNC('month', [Order Date]))
)

Use Case:

  • Perfect for time-series forecasting or spatial predictions.
  • Requires an ordered dimension (e.g., months) as a predictor.

Quick Model Selection Guide

ModelBest for…Example Use Case
Linear RegressionSingle predictor with a linear relationship to the target metric.Monthly sales predictions.
Regularized Linear RegressionMultiple predictors with linear relationships and potential multicollinearity.Multi-metric profit forecasts.
Gaussian Process RegressionNonlinear relationships or predictions across continuous domains like time or space.Shipping time projections.

Conclusion: Mastering Predictive Analytics in Tableau

Predictive modeling functions in Tableau empower users to forecast trends and make data-informed decisions. Whether you’re leveraging linear regression for simple insights, regularized regression for complex datasets, or Gaussian regression for nonlinear relationships, Tableau provides flexible tools to adapt to any scenario.

Start exploring these capabilities today to unlock the predictive potential of your data. As you experiment, let the models guide you to uncover trends, optimize strategies, and anticipate opportunities in an ever-changing landscape.