*Forecasting* is a result manipulation that uses patterns in your data to predict future results. If you want to view a 'what if' analysis or how results are affected by a change in data, see Creating a global variable.

Forecasting only uses values from date fields with at least two cycles of data. A cycle of data is a period broken down into multiple values. For example, a year is broken down by month or week. In auto-mode, the forecast will recognize each year as a cycle, so you need two years of data to generate a forecast.

**To add a forecast to your query**

- In Query Builder, click the result manipulation icon ().
- Click
**Forecast**. - Check
**Calculate a forecast on the result**box to open your forecasting options. - Enter a path for your results. Your path indicates how the calculation is computed. The path is where you add your date attributes.
- Under
**Method**, choose either**Additive trend and multiplicative season**or**Additive trend and additive season**. - Select the number of values you want to predict.
If you select the

**Custom**option, you can specify the number of values. If you select**Auto**, Explore will automatically calculate a number based on your dataset. - Select the values per cycle.
If you select the

**Custom**option, you can enter a specific number of values. For example, for 12 months of data, you can select 6 values per cycle. - When you are finished selecting values, click
**Apply**. - Select either a bar, column, area, line, or sparkline chart. Forecast results will not appear on any other chart types.

## How forecasting works (advanced)

The forecasting method that Explore uses is based on the **Holt winters** model, which is a **triple exponential smoothing** that relies on the level, the trend, and the season of a time series.

In Explore, we use two sub-models that fit most use-cases, and also take into account seasonal variations.

### Periods per cycle

In the calculation, we also use the value “Periods per cycle”. It is used to determine the length of a season, needed to process seasonal indices. In the following formulas, this value is named “h”.

### Smoothing parameters

Three other parameters must be defined before the processing of the forecast. They correspond to smoothing parameters, called “α” for the level, “β” for the trend, “γ” for the seasonality. In brief, they correspond to a ratio of the importance given to the firsts and lasts values of the time-based series, and will influence the results of each period. Here is an example:

*“The estimated values of alpha, beta and gamma are 0.41, 0.00, and 0.96, respectively. The value of alpha (0.41) is relatively low, indicating that the estimate of the level at the current time point is based upon both recent observations and some observations in the more distant past. The value of beta is 0.00, indicating that the estimate of the slope b of the trend component is not updated over the time series, and instead is set equal to its initial value. This makes good intuitive sense, as the level changes quite a bit over the time series, but the slope b of the trend component remains roughly the same. In contrast, the value of gamma (0.96) is high, indicating that the estimate of the seasonal component at the current time point is just based upon very recent observations.”*

For the three optimization parameters, there is no official algorithm to find the best ones. This turns into a NP-Complete problem, where the optimization problem is to minimize the mean squared error of the forecasted results, with 0≤α≤1, 0≤β≤1, 0≤γ≤1.

Thus, Explore has its own algorithm to find in a linear time the best three parameters, with an accuracy of 0.01.

## The AA method

The AA (Additive trend and Additive season) model is the default because it is the most commonly used, and produces the most realistic results.

Initial values are processed with the formula below:

Then, we can apply the Holt Winters AA model:

## The AM method

The AM (Additive trend and Multiplicative season) model is, in some cases, a time-based trend.

Initial values are processed with the formula below:

Then, we can apply the Holt Winters AM model:

## Comments

5 comments

I'm very interested in this 'forecast' function, and may I have a rough picture on what is the mechanism of this predicting function?

Kind of what Daniel's asking as well, I'd like more in depth info on how "

Additive trend and multiplicative seasonorAdditive trend and additive seasonmethod options" work and differ from each other.Hi Ryan, I'm digging into this question, and I'll try and get you an answer and update the docs as soon as I can.

Hi again Ryan, I received some quite in-depth information about how forecasting works, and have added it to a section at the end of the article. I hope this helps, but if you have any problems, do let us know. Thanks! - Rob

Great, thanks Rob. Some of it's a little over my head as an admin, but it definitely gives me more to go on, especially so I can communicate it to and work with our own internal analytics and reporting teams!

Please sign in to leave a comment.