Week-over-week change with DATEADD and -7 days
Compare each week with the week before by shifting dates back 7 days with DATEADD, so the comparison works across year boundaries.
You will learn to
- Shift a week back with DATEADD and DAY
- Explain why “week number − 1” breaks in week 1
- Blank a change when there is nothing to compare with
How it works
DAX has no `PREVIOUSWEEK` function, and `DATEADD` has no WEEK interval. But a week is always **seven days**, so `DATEADD('Date'[Date], -7, DAY)` moves every visible day back exactly one week: Sunday to the Sunday before, and so on. In a week row that is the whole previous week.
The tempting alternative, `'Date'[Week Number] = MAX('Date'[Week Number]) - 1`, breaks in **week 1**: there is no week 0, so the comparison vanishes instead of reaching back into December. Shifting dates doesn’t care about year boundaries.
Store last week in a variable and return the change only when last week exists, so the first week of the data shows blank instead of its full sales as “growth”.
Practice it hands-on with a real data model and a live report that updates as you type.
Change vs Yesterday = VAR Prior = CALCULATE([Total Sales], DATEADD('Date'[Date], -1, DAY)) RETURN IF(NOT ISBLANK(Prior), [Total Sales] - Prior)