The timeseries() function is one of the most powerful capabilities in CRM Analytics. It analyses your historical data, selects the forecasting model that gives the best statistical fit, detects seasonality and periodic cycles, and projects what your data will look like in the future — all without a data scientist in the room.

What timeseries() does for you
Out-of-the-box forecasting capabilities
Automatically selects the best-fit forecasting model for your data
Detects seasonality and accounts for periodic cycles in predictions
Works at Year and Month granularity out of the box
Available in both the UI (Compare Table widget) and directly in SAQL

Out of the box, you can apply timeseries() to any existing dataset column at the Year and Month level. But there is a significant limitation that catches many practitioners by surprise.

The limitation: The timeseries() function in the Compare Table UI does not allow you to select a formula column as the input. If you create a calculated field — such as Quota Achievement Rate, Opportunity Win Rate, or any custom percentage — it will not appear in the column selection dropdown for timeseries forecasting. Only native dataset columns are available.

The workaround is a clean two-part SAQL approach. You build the table using the UI first to capture the formula syntax, then switch to SAQL mode and make two targeted updates. Here is the complete process across six steps.

Intro walkthrough: Demonstrating the standard timeseries() function applied directly to an existing dataset column — showing the out-of-the-box behaviour before encountering the formula column limitation. Originally published at einsteinplusanalytics.com.

Part 1 — Build in the UI Set up the table and capture the formula
Step 1
Create the Compare Table with all columns including your formula

Build your Compare Table using the visual query builder. Add your existing dataset columns and create the formula column you want to forecast. In the example below, the table includes:

— Monthly Units Sold (existing dataset column)
— Monthly Target (existing dataset column)
— Target Achievement Rate (formula column: Units Sold ÷ Target, formatted as a percentage)

At this stage, do not worry about timeseries. The goal of this step is simply to get the formula column created so that CRM Analytics generates the underlying SAQL syntax for it. You will need that syntax in Step 4.

Why build in the UI first? Writing formula column SAQL from scratch is tedious and error-prone. Building in the UI first lets CRM Analytics generate the correct foreach generate syntax automatically — you just copy it in Step 4.
Video walkthrough — Step 1: Adding the two dataset columns to the Compare Table and creating the Target Achievement Rate formula column using the visual query builder. Originally published at einsteinplusanalytics.com.
Step 2
Apply timeseries to any existing column as a temporary placeholder

Since your formula column does not appear in the timeseries dropdown, select any existing dataset column from the list instead — for example, Monthly Units Sold. Apply the timeseries() function to it with your desired interval and forecast length.

This is a temporary placeholder. You are not interested in forecasting Units Sold — you are using it purely to generate the correct SAQL structure for the timeseries function, which you will then redirect to your formula column in Step 5.

Video walkthrough — Step 2: Selecting Monthly Units Sold as the temporary timeseries input column and configuring the forecast interval and prediction length. Originally published at einsteinplusanalytics.com.
Part 2 — Edit in SAQL Two targeted updates to unlock formula forecasting
Step 3
Convert the query to SAQL mode

With the table configured, switch the query from visual mode to SAQL mode. In the query editor toolbar, click the SAQL toggle button.

CRM Analytics will generate the full SAQL representation of everything you built in the UI — including the foreach generate statement for your formula column and the timeseries() call on your placeholder column. This is the SAQL you will edit in Steps 4 and 5.

Video walkthrough — Step 3: Switching the Compare Table query from visual builder mode to SAQL mode and reviewing the generated code. Originally published at einsteinplusanalytics.com.
Step 4
Find the formula syntax and compute it in the first foreach generate statement

In the generated SAQL, locate the foreach generate statement. This is where CRM Analytics computes row-level values. You will see your formula column expression somewhere in this block — something like:

Generated SAQL — locate this pattern
// Inside the foreach generate block:
('Units_Sold' / 'Monthly_Target') * 100 as 'Achievement_Rate'

Copy this computed expression. Give it a clear, meaningful name — something you will recognise in Step 5. This named field is what you will pass into the timeseries() function in the next step.

Exact syntax matters: Make sure the field name you assign here matches exactly what you reference in the timeseries() call in Step 5. SAQL field names are case-sensitive.
Video walkthrough — Step 4: Locating the formula expression inside the foreach generate block, adding it as a named computed field, and verifying the naming for use in the timeseries call. Originally published at einsteinplusanalytics.com.
Step 5
Replace the placeholder column in the timeseries call with your formula field

Find the timeseries() function call in the SAQL. It currently references your placeholder column (Monthly Units Sold). Replace that column reference with the named formula field you computed in Step 4.

SAQL — before and after
-- Before (placeholder column):
timeseries('Units_Sold', ...)

-- After (your formula field):
timeseries('Achievement_Rate', ...)

Then clean up the SAQL — remove or comment out any unnecessary statements and extra fields that were added by the UI builder but are no longer needed. Keep only the columns you want to display in the final chart.

Video walkthrough — Step 5: Replacing the placeholder column reference in the timeseries() call with the formula field name, removing redundant statements, and running the updated SAQL to confirm the forecast is generated correctly. Originally published at einsteinplusanalytics.com.
Step 6
Convert to a Timeline chart and configure the visualisation

Switch the widget type from Compare Table to a Timeline chart. Configure the chart properties:

— Set the time axis to your date dimension (Year-Month)
— Set the value axis to your Achievement Rate field
— Enable the Predictive line property to show the forecast segment as a distinct visual element
— Optionally add a reference line or confidence band

The chart now shows your historical Target Achievement Rate as a solid line, with the timeseries forecast extending forward as a predictive line — all driven by your custom formula column.

Video walkthrough — Step 6: Switching the widget to a Timeline chart, configuring the axes and predictive line property, and reviewing the final forecast visualisation. Originally published at einsteinplusanalytics.com.

Two SAQL edits. Any formula. Full timeseries forecasting — no data science team required.


About the Author
Rashid Haq
Enterprise Analytics Architect · CRM Analytics Specialist

22+ years delivering enterprise analytics. CRM Analytics practitioner, Salesforce Analytics Champion 2020, Tableau CRM Ambassador 2021–23. Originally published at einsteinplusanalytics.com.

Back to all articles Resource Library