Daily DAX : Day 467 PREVIOUSWEEK
DAX Function: PREVIOUSWEEK
Purpose: Returns a table with all dates from the previous week (relative to the first date in the current context).
Syntax
PREVIOUSWEEK ( <Calendar> )
<Calendar> = reference to your date/calendar table (must be properly marked as date table or used in enhanced time intelligence mode)
Important Requirements
- You need a proper Date / Calendar table
- Best used with Enhanced DAX Time Intelligence (preview feature → now more widely available)
- Usually combined with
CALCULATE
Most Common Use Case
Compare this week vs previous week (week-over-week analysis)
Typical pattern – Previous Week Sales:
Previous Week Sales =
CALCULATE(
[Total Sales],
PREVIOUSWEEK( 'Calendar' )
)
Other useful variations:
-- Previous week margin %
Previous Week Margin % =
DIVIDE(
CALCULATE([Total Margin], PREVIOUSWEEK('Calendar')),
CALCULATE([Total Sales], PREVIOUSWEEK('Calendar'))
)
-- WoW % change
WoW Growth % =
DIVIDE(
[Total Sales] - [Previous Week Sales],
[Previous Week Sales]
)
Typical Business Use Cases
- Week-over-week sales / revenue comparison
- Compare current week orders vs previous week
- Monitor weekly active users / sign-ups
- Week-to-date vs full previous week comparison
- Retail / e-commerce performance tracking (very common)
- Quick detection of sudden drops or spikes week-to-week
Quick Example Output (imagine calendar starting Monday)
| Selected Date | PREVIOUSWEEK returns dates... |
|---|---|
| 2026-01-22 (Wed) | 2026-01-12 to 2026-01-18 |
| 2026-01-19 (Mon) | 2026-01-05 to 2026-01-11 |
Tip: If your week starts on Sunday or has a fiscal week definition → make sure your calendar table reflects that correctly.
Comments
Post a Comment