Daily DAX : Day 454 DATESWTD
DATESWTD – Week-To-Date in DAX
DATESWTD returns all dates from the start of the current week up to the date in context.
Basic Syntax
DATESWTD(<dates> [, <week_start_day>])
- <dates> → usually your calendar table date column
- <week_start_day> → optional
• 1 = Monday (most common in Europe/UK) ← default in many countries
• 2 = Tuesday
• …
• 7 = Sunday (most common in USA)
Most Common Real-World Use Cases
| What you want | Typical Measure | Formula |
|---|---|---|
| Week-to-date Sales | WTD Sales |
WTD Sales = CALCULATE([Total Sales], DATESWTD('Calendar'[Date]))
|
| WTD Orders (week starts Monday) | WTD Orders |
WTD Orders = CALCULATE([Order Count], DATESWTD('Calendar'[Date], 1))
|
| WTD (week starts Sunday – US style) | WTD Sales US |
WTD Sales US = CALCULATE([Sales], DATESWTD('Calendar'[Date], 7))
|
Quick Reference – What dates are returned?
Today = Wednesday 15th January 2025
DATESWTD(..., 1) → Monday → Sunday (European style)
→ returns: 13, 14, 15 Jan
DATESWTD(..., 7) → Sunday → Saturday (US style)
→ returns: 12, 13, 14, 15 Jan
DATESWTD(..., 1) → Monday → Sunday (European style)
→ returns: 13, 14, 15 Jan
DATESWTD(..., 7) → Sunday → Saturday (US style)
→ returns: 12, 13, 14, 15 Jan
Most important notes
- Needs a proper marked as date table calendar
- Usually combined with
CALCULATE - Very useful for: WTD / PY WTD / WTD vs Last Week comparisons
- Does NOT respect row context — only filter context
Comments
Post a Comment