Sales last year with SAMEPERIODLASTYEAR
Put last year’s figure next to this year’s, month by month, by shifting the dates back twelve months.
You will learn to
- Shift a date filter back one year
- Combine a shifted date table with CALCULATE
- Explain why the first year shows blanks
How it works
To compare with last year you need last year’s number **in this year’s row**. `SAMEPERIODLASTYEAR('Date'[Date])` takes the dates visible right now and returns the same dates one year earlier: March 2025 becomes March 2024.
Like `DATESYTD`, it returns a table of dates, so it goes inside `CALCULATE` as a filter. On its own it is a table, and a measure must return a single value.
Our data starts in 2024, so there is no “last year” for 2024. Those rows are blank, and that is correct: blank means “no data”, not zero.
Practice it hands-on with a real data model and a live report that updates as you type.
Sales Last Quarter = CALCULATE([Total Sales], DATEADD('Date'[Date], -1, QUARTER))