over
Applies a window function over a partition of rows.
Syntax
over(<expr>, <partitions>, <sorts>)
| Parameter | Type | Description |
|---|---|---|
| expr | any | The expression to evaluate. |
| partitions | Array | The Partitions value. |
| sorts | Array | The Sorts value. |
Return values
Depends on input arguments.
Usage
Calculates the sum of total prices partitioned by customer ID, sorted by creation date.
over(sum(orders.total_price), partitions: [orders.customer_id], sorts: [orders.created_at asc])