*Forecasting* is a result manipulation that uses patterns in your data to predict future results.

Forecasting 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.

This article contains the following topics:

## Forecasting basics

Use this procedure to learn how to add a forecast to your query.

**To add a forecast to your query**

- In Query Builder, create a time-based query. For example, you could add
**COUNT(Tickets)**to the**Metrics**panel and**Ticket created - Year**to the**Columns**panel. - Click the result manipulation icon (), then click
**Forecast**. - In the
**Forecast**menu, check**Calculate a forecast on the result**The options to configure forecasting are displayed.

**Path**determines whether the forecast is based on the columns, or the rows in your chart. Whichever you choose must contain a date-based attribute. The path always contains the date-based attribute for your forecast.- Under
**Method**, choose either**Additive trend and multiplicative season**or**Additive trend and additive season**.To learn more about the forecasting methods you can use, see How forecasting works below.

- Under
**Values to predict**, choose one of the following:**Auto:**Let Explore automatically calculate the optimum number of values ahead to predict.**Custom**: Specify the number of values to look ahead. For example, if you're attribute is year based, you'll specify the number of years you want to forecast ahead.

- Under
**Values per cycle**, you can configure the number of data points you include in each cycle. For example, for 12 months of data, you can select 6 values per cycle. If you select**Auto**, Explore calculates the optimum number of values to use. - When you are finished, click
**Apply**. - From the visualization menu (), choose either a bar, column, area, line, or sparkline chart. Forecast results are not displayed on other chart types.

The forecasted porting of the chart is shown in a different style. For example, the forecasted portion of a line chart is shown as a dotted line, for example:

**forecast_error_year_missing**. You can resolve this error by including a year-based attribute in your query also (because year-based attributes do not recur).

For example, if your query contains the attribute **Ticket created - Month** and you have been collecting data for over a year, then the values in this field are aggregated and you'll see the error message. Add the attribute **Ticket created - Year** also to resolve the error.

## 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.

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

### 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:

## 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 formulas above, 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.

## 12 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!

Hi! My team was so excited about this feature, but we're having a really hard time getting it to work. We keep getting the error "forecast error year missing. If we're just trying to predict tickets created by week, and we have at least 2 years of data, what is the error referring to?

Hi Emma, I've opened a ticket on your behalf so somebody can look at your issue more closely. I'll be sure to update the docs if necessary once this ticket is resolved.

Thank you, Rob! Appreciate your quick action!

I'm also getting the "forecast_error_year_missing" message that Emma mentioned while trying to look at tickets created per month thus far, and using that to forecast tickets per month for the remainder of the year.

Hello Jasen,

I went ahead and ran some tests to see if the following would suffice as a solution to your error and I'm happy to report the instructions below should resolve your issue.

So when you are using date levels, it's essential to make sure that you have all the appropriate levels in the query for the results to be accurate - and in the right order! If you use [month of year] and you have more than one year of data, the results will be aggregated - i.e., month 1 will show results for month 1 2018, and 2019 added together.

For this reason, you also need to use the [year] level on the query, before the [month], to split everything out and keep it in the right order.

Hope this clears things up a bit and let me know if you need anything else clarified further.

Awesome, thanks Devan! That worked for using all-time data, but if I try to forecast using only 2019 thus far (or 2018-2019), I get a new error that says "You need to have data for at least 2 cycles to forecast your result. Your current cycle length is 24." Any tips for that?

Hi Jasen,

Could you send me a screenshot of the settings you are selecting so I can run this buy one of our experts and see exactly where is mishap is taking place?

Please sign in to leave a comment.