Analytics SAQL Developer Guide
Summer '26 (API version 67.0)
Spring '26 (API version 66.0)
Winter '26 (API version 65.0)
Summer '25 (API version 64.0)
Spring '25 (API version 63.0)
Winter '25 (API version 62.0)
Summer '24 (API version 61.0)
Spring '24 (API version 60.0)
Winter '24 (API version 59.0)
Summer '23 (API version 58.0)
Spring '23 (API version 57.0)
Winter '23 (API version 56.0)
Summer '22 (API version 55.0)
Spring '22 (API version 54.0)
Winter '22 (API version 53.0)
Summer '21 (API version 52.0)
Spring '21 (API version 51.0)
Winter '21 (API version 50.0)
Summer '20 (API version 49.0)
Spring '20 (API version 48.0)
Winter '20 (API version 47.0)
Summer '19 (API version 46.0)
Spring '19 (API version 45.0)
Winter '19 (API version 44.0)
Summer '18 (API version 43.0)
Spring '18 (API version 42.0)
Winter '18 (API version 41.0)
Summer '17 (API version 40.0)
Spring '17 (API version 39.0)
Winter '17 (API version 38.0)
Summer '16 (API version 37.0)
Spring '16 (API version 36.0)
Winter '16 (API version 35.0)
Newer Version Available
SAQL Statements
A query is made up of statements. Each SAQL statement has an input stream, an operation,
and an output stream.
-
arimax
Uses existing data to predict future data points. The arimax statement must follow a projection statement in your query. Perform any filtering pre-projection or after the arimax statement. -
cogroup
Use cogroup to combine data from two or more data streams into a single data stream. The data streams must have at least one common field. -
fill
Use fill() to fill in any gaps in date fields. You most often use fill() before using the timeseries statement. By specifying the date fields to check, fill() creates a row that contains the missing month, day, week, quarter, or year and includes a null value. To include values outside the bounds of your data’s date range, specify a start date and end date to override existing limits. The function returns the missing date rows with null values. -
filter
Selects rows from a dataset based on a filter predicate. -
foreach
Applies a set of expressions to every row in a dataset. This action is often referred to as projection. -
group-by
Organizes the rows returned from a query into groups. Within each group, you can apply an aggregate function, such as count() or sum() to get the number of items or sum, respectively. -
group-by rollup
rollup is a subclause of group-by that creates and displays aggregations of grouped data. The output of rollup is based on column order in your query. -
join semi and anti (Beta)
Use the join statement with the join_type to create semi-join or anti-join results. -
limit
Limits the number of results that are returned. If you don’t set a limit, queries return a maximum of 10,000 rows. -
load
Loads a dataset. All SAQL queries start with a load statement. -
offset
Use offset to page through the results of your query. -
order
Sorts in ascending or descending order on one or more fields. -
sample
Returns a random sample from a large dataset, where each data point has an equal probability of being selected. This keyword uses the Bernoulli distribution. -
timeseries
Uses existing data to predict future data points. The timeseries statement must follow a projection statement in your query. Perform any filtering pre-projection or after the timeseries statement. -
union
Combines multiple result sets into one result set. The result sets must have the same field names and structure. You can use a different dataset to create each result set, or you can use the same dataset.