Skip to main content
Applies a SQL window function to the result of another measure, such as a running total, a rank within a group, or the value from a previous row. Use partition_by to split the rows into separate windows, order_by to sort the rows within each window, and offset_start/offset_end to set the frame of rows the function considers. The measure’s sql must reference other measures, not raw columns or dimensions. Define the aggregate you want to apply the window function to as its own measure first.
Window measures can only be edited in the model IDE.

How it works

This cumulative_arr_change measure takes the arr_change measure and sums it again, creating a running total ordered by date:
The inner query computes arr_change per date, same as it would without a window. The window block then tells Omni to apply the measure’s sql — SUM(${arr_change}) — as a window function over those per-date rows, ordered by arr_dates.date. Because neither offset_start or offset_end is set, the frame defaults to every row from the start of the partition through the current row, producing a running total.

Syntax

Properties

object
The name of the measure. Measure names must:
  • Be unique within the view
  • Start with a letter
  • Contain only alphanumeric characters and underscores

Examples

Cumulative sum
Trailing 3-period average
Rank within a partition
Lag