dax-window-functionslisted
Install: claude install-skill CSalcedoDataBI/dax-for-agents
# DAX Window Functions — the navigation machinery
## Overview
The `WINDOW` family operates over a **relation** (a virtual table), not scalars: it is evaluated in the current filter context, **partitioned**, **sorted**, then **navigated** relative to the current row. This is the machinery inside rolling/trailing UDFs — see **`dax-udf-authoring`**.
**Per-function reference:** **`dax-reference`** carries each function's signature, return type and where it is legal. This skill is the working summary of how the family behaves together, plus the gotchas that bite.
## Pick the function
| Need | Function | Returns |
|---|---|---|
| Contiguous set of rows (rolling/trailing window) | `WINDOW` | table |
| Single row at a relative offset (prior/next, YoY) | `OFFSET` | row(s) |
| Single row at an absolute position (first/last) | `INDEX` | row |
| Rank within partition (ties allowed) | `RANK` | scalar |
| Unique row number (no ties) | `ROWNUMBER` | scalar |
| Moving avg / running sum **(visual calc ONLY)** | `MOVINGAVERAGE` / `RUNNINGSUM` | scalar |
Table-returning ones (`WINDOW/OFFSET/INDEX`) are wrapped in an aggregator (`AVERAGEX`, `SUMX`) or used as a `CALCULATE` filter.
## Shared positional tail (order is FIXED)
```
[, <relation>/<axis>][, <orderBy>][, <blanks>][, <partitionBy>][, <matchBy>][, <reset>]
```
Skip `relation` but keep `orderBy`: leave the slot empty → `OFFSET(-1, , ORDERBY(...))`.
## ABS vs REL — the crux of WINDOW
- **REL (relative):** offset from the **current