SQL Server Analysis Services Docs

Time Series Forecasting Algorithm

The Time Series Forecasting algorithm creates predictive models that generate forecasts for future values of a time‑dependent variable. It is part of Microsoft SQL Server Analysis Services (SSAS) Data Mining.

When to Use

How It Works

The algorithm builds a model by applying the ARIMA (Auto‑Regressive Integrated Moving Average) technique combined with exponential smoothing. It automatically detects:

Overview
Parameters
Example

The model stores the historical values and uses them to forecast future points. You can request the Predicted column in a mining query to retrieve the forecast.

Key Parameters

ParameterDescription
PredictionLengthNumber of future periods the model should forecast.
ConfidenceLevelConfidence interval (0‑100) for prediction bounds.
SeasonalityLength of the seasonal cycle (e.g., 12 for monthly data).
HorizonHow many steps ahead to train the model.

Creating a Time Series Model

CREATE MINING MODEL [dbo].[SalesForecast]
FROM [dbo].[SalesData]
WITH (TYPE = TIME_SERIES,
      DATA_SOURCE = (TABLE = [dbo].[SalesData]),
      TARGET_COLUMN = [SalesAmount],
      TIME_ID_COLUMN = [SaleDate],
      TIME_ORDER_COLUMN = [SaleDate],
      PREDICTION_LENGTH = 12,
      CONFIDENCE_LEVEL = 95);

Querying the Forecast

SELECT [SalesAmount], [Predicted] 
FROM OpenQuery([YourSSAS], 'SELECT * FROM [SalesForecast]') 
WHERE [SaleDate] >= DATEADD(month, -24, GETDATE());

Best Practices

  1. Ensure the TIME_ID_COLUMN is of a date/time type and has no gaps.
  2. Remove outliers or use a robust preprocessing step.
  3. Experiment with different Seasonality values to capture actual cycles.

References