sum of revenue) or transform other measures (like sum of profit / count of users).
Naming measures
Measure names must be unique within a view. Names may use characters a-z (no capital letters), 0-9, or underscores, and must start with a letter. Additional parameters are nested under the measure with one tab (two spaces) of indentation:Defining measures
You can define measures in two ways: using theaggregate_type parameter for standard aggregations, or writing a raw SQL aggregate in the sql parameter.
Using aggregate_type
Using raw SQL
aggregate_type is recommended when a standard aggregation fits your use case, as Omni can apply additional optimizations like symmetric aggregation to protect against join fanout.
Refer to the aggregate_type parameter documentation for a list of supported aggregates.
Filtered measures
You can apply filters to a measure to create conditional aggregations. Filtered measures aggregate only the rows that match the specified filter conditions:Measures referencing other measures
Measures can reference other measures to create compound metrics. When a measure references another measure, the referenced measure is computed first, and the result is used in the outer calculation:Semi-additive measures with omni_dimensionalize
Semi-additive measures are aggregations that can be summed across some dimensions but not all. Consider an end-of-day bank account balance. Summing this value across all days would produce an inaccurate number, since the balance represents a running total rather than an incremental change. To handle this, you need a way to pick the correct balance (for example, the most recent one) within each grouping, and then aggregate across other dimensions like account type. In Omni, you can build semi-additive measures using theomni_dimensionalize function. This function converts a measure into a dimension within the query’s grouping context, which you can then use for filtering: