Reference to the linearforecast function


linearforecast(<forecastOffset>, <historyLength>, <tsExpression>)

Predicts the value of the time series using simple linear regression.

forecastOffset Specifies how far into the future you want to forecast.
historyLength Specifies how far back the algorithm should to for data to use in the prediction.
tsExpression Optional expression to which you want to apply this function.


Predicts the value for tsExpression using simple linear regression. The query goes forecastOffset into the future and uses historyLength to specify how far back the prediction algorithm should go to do the forecast.

This function can be useful for resource limit alerts, where fixed thresholds or percentage thresholds tend to have false positives and false negatives depending on the size of the resource you are working with. Here linearforecast() works better for all sizes.


The following screenshot shows the forecast for a simple metric. The screenshot was taken at 10:15 a.m., and we moved out the time to see the predictive data.

forecast function

See Also

  • Use hw() to perform prediction and smoothing on seasonal or non-seasonal data.