Cheat Sheets/Power BI/SAMEPERIODLASTYEAR
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

Related DAX functions

From Time intelligence

Used in these tutorials

← Back to the Power BI (DAX) cheat sheet