Last year’s full total with PREVIOUSYEAR
Put last year’s entire sales total in every month of this year, and see how it differs from SAMEPERIODLASTYEAR.
You will learn to
- Return the whole previous calendar year with PREVIOUSYEAR
- Contrast PREVIOUSYEAR with SAMEPERIODLASTYEAR
- Pick the right function for a “last year” question
How it works
“Last year” can mean two different things, and DAX has a function for each:
- `SAMEPERIODLASTYEAR` shifts the visible dates back a year. March 2025 becomes March 2024: a **like-for-like** comparison. - `PREVIOUSYEAR` looks at the **first visible date** and returns every day of the year before it. March 2025 gets all of 2024: the **full-year** figure.
The full-year version answers questions like “what share of last year’s total have we reached?” or “how does this month compare with last year’s monthly average?” Every month of 2025 shows the same number, because they all fall in a year whose previous year is 2024.
Both return tables of dates, so both go inside `CALCULATE`. In a 2025 year row they agree; it is in month and quarter rows that they part ways.
Practice it hands-on with a real data model and a live report that updates as you type.
Quantity PY = CALCULATE([Total Quantity], PREVIOUSYEAR('Date'[Date]))