Window Function
Rank, row number, lead, lag
What It Does
Window Functions compute values across related rows without collapsing them. Add rankings, running totals, or access adjacent row values.
How to Use It
Opening the Panel
Click the + button in the toolbar or press the operation picker, then search for "Window Function". It's in the Aggregate group.
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
Function | Select | Yes | row_number, rank, dense_rank, lead, lag, running_total, sum, avg, min, max |
Column | Column select | For value functions | The column to compute over |
Partition by | Column select | No | Reset the window for each group |
Order by | Column select | Recommended | Sort rows within each partition |
SQL generated under the hood
SELECT *, ROW_NUMBER() OVER (PARTITION BY category ORDER BY revenue DESC) AS rank FROM data
Related Operations
- Pivot - Pivot table (rows to columns)
- Smallest - Get nth smallest value as a column
- Largest - Get nth largest value as a column