DAX function
SAMEPERIODLASTYEAR — DAX function reference
Shift context back one year.
Syntax
dax
SAMEPERIODLASTYEAR(<dates>)
Examples
dax
CALCULATE(SUM(Sales[Amount]), SAMEPERIODLASTYEAR('Date'[Date]))→ Last year's value
dax
VAR ThisYear = SUM(Sales[Amount])
VAR LastYear = CALCULATE(SUM(Sales[Amount]), SAMEPERIODLASTYEAR('Date'[Date]))
RETURN DIVIDE(ThisYear - LastYear, LastYear)→ YoY growth %
dax
CALCULATE(SUM(Sales[Amount]), SAMEPERIODLASTYEAR('Date'[Date]), ALL(Sales[Region]))→ Last year's total across all regions, regardless of the current region filter
Common mistakes & gotchas
- SAMEPERIODLASTYEAR is shorthand for DATEADD(dates, -1, YEAR) — it shifts by exactly one calendar year, so a partial period selection (e.g., only Jan–Feb) correctly returns only Jan–Feb of last year, not the full year.
- It relies on the current date filter context to know 'this period' — with no date filter at all (e.g., a card with no date slicer), it shifts the entire date table's range, which is rarely what's intended.
Related DAX functions
From Time intelligence