Short answer: OFFSET ( delta, relation, ORDERBY ( ... ) [, blanks] [, PARTITIONBY ( ... )] ) returns the row delta positions away from the current row in a sorted table: -1 is the previous row, 1 the next. Used as a filter in CALCULATE, it gives "the value of the previous month" or "the next product in the ranking" without date functions: CALCULATE ( [Revenue], OFFSET ( -1, ALLSELECTED ( 'Date'[Year Month] ), ORDERBY ( 'Date'[Year Month] ) ) ). With PARTITIONBY the offset restarts in each group.
Date functions shift by calendar periods; OFFSET shifts by rows. That makes it work for orders that are not dates (the previous version, the previous step of a process) and for date axes with gaps.
What does OFFSET return?
| Year Month | Revenue | Previous row | Change |
|---|---|---|---|
| 2026-01 | 120 | ||
| 2026-02 | 135 | 120 | +15 |
| 2026-03 | 150 | 135 | +15 |
| 2026-04 | 142 | 150 | -8 |
| 2026-05 | 155 | 142 | +13 |
Revenue Previous Month =
CALCULATE (
[Revenue],
OFFSET ( -1, ALLSELECTED ( 'Date'[Year Month] ), ORDERBY ( 'Date'[Year Month] ) )
)
Change vs Previous = [Revenue] - [Revenue Previous Month]What do the arguments do?
| Argument | Meaning |
|---|---|
| delta | rows before (negative) or after (positive) the current row |
| relation | the table to move in; if omitted, ALLSELECTED of the ORDERBY and PARTITIONBY columns |
| ORDERBY | how rows are sorted; any scalar expression, ASC by default |
| blanks | where blanks sort: BLANKS DEFAULT, FIRST or LAST (set inside ORDERBY in newer syntax) |
| PARTITIONBY | columns that define groups; the offset does not cross groups |
| MATCHBY | columns that identify the current row, when ORDERBY and PARTITIONBY do not |
The current row is found by matching the visual's current values of the relation's columns. If the visual has Year and Month as separate columns, put both in the relation and the ORDERBY.
How do you restart per group?
-- previous month within the same year: January has no previous
Revenue Prev Month in Year =
CALCULATE (
[Revenue],
OFFSET (
-1,
ALLSELECTED ( 'Date'[Year], 'Date'[Month Number] ),
ORDERBY ( 'Date'[Month Number] ),
PARTITIONBY ( 'Date'[Year] )
)
)OFFSET, DATEADD or PREVIOUS?
| Use | When |
|---|---|
DATEADD ( 'Date'[Date], -1, MONTH ) | calendar periods: the previous month even if it is not on the visual |
OFFSET ( -1, ... ) | the previous row: skipping months that the filter hides, or non-date orders |
PREVIOUS ( [Revenue] ) | a visual calculation on one visual, no model logic |
If a slicer hides March, OFFSET compares April with February (the previous visible row), while DATEADD still compares with March.
What goes wrong?
- Ties in ORDERBY. Two rows with the same sort value make "previous" ambiguous; order by a unique column.
- Relation missing a visual column. If the visual groups by a column not in the relation, rows repeat or the result is blank; include it or use
MATCHBY. - Sorting by a text month. "Apr" before "Feb"; order by a number or a Year Month key.
- Totals. At the total row there is no current row to offset from; the result is usually blank.
Where can you check this?
- Microsoft Learn: OFFSET function (DAX)
- Microsoft Learn: ORDERBY function (DAX)
- Microsoft Learn: PARTITIONBY function (DAX)
Where do you start?
Write Revenue Previous Month with OFFSET and compare it with a DATEADD version on a chart with a month slicer. WINDOW returns several rows instead of one.