AMQL Docs
AQL ReferenceFunctions

Metric Functions Overview

Metric functions transform a metric expression by modifying its context: its filters, relationships, level of detail, or time window.

Metric functions transform an input metric expression into another metric expression, usually by modifying the context that the input is evaluated in: its filters, its relationships, its level of detail, or its time window.

They split into five categories:

CategoryWhen to reach for itFunctions
ConditionRestrict which rows feed into the metric.where
RelationshipOverride the dataset's default joins for a specific metric.with_relationships
Level of DetailForce the metric to compute at a specific grain (independent of the report's grouping).of_all, keep, dimensionalize, percent_of_total
Time-basedShift, accumulate, or compare across time periods.running_total, period_to_date, exact_period, relative_period, trailing_period
WindowRank, navigate to neighboring rows, or aggregate across a moving frame. Analogous to SQL window functions (see the Window Functions overview).rank, dense_rank, ntile, percent_rank, first_value, last_value, nth_value, previous, next, window_sum, window_avg, window_min, window_max, window_count, window_stdev, window_stdevp, window_var, window_varp

See also

On this page