Last year with SAMEPERIODLASTYEAR
SAMEPERIODLASTYEAR(Date[Date]) shifts the dates of the cell back one year: Q2 2025 becomes Q2 2024. Inside CALCULATE it gives last year’s value next to this year’s.
The model starts in 2024, so 2024 has no last year and stays BLANK. In the grand total (both years) the shifted dates are 2023 and 2024, and only 2024 exists.
Your task
Write Sales LY: the Sales Amount of the same period one year earlier.
About this exercise
You practise comparing with the year before with CALCULATE and SAMEPERIODLASTYEAR. The exercise runs on a small bike-shop model with a Sales fact table and Product, Customer and Date dimensions, the same star schema in every lesson.
Your measure, Sales LY, fills a Power BI-style matrix grouped by Date[Year] and Date[Quarter]. As in a real report, each cell evaluates the measure in its own filter context, and the subtotals and the grand total are evaluated again in theirs rather than added up. When you check your answer, every cell is compared with the expected value, wrong cells are marked, and the hint is about the mistake you made.
Measures that already exist in the model: Sales Amount. Reference them in square brackets, for example [Sales Amount].
Where you start
Sales LY =The result to build
| Year › Quarter | Sales LY |
|---|---|
| 2024 | |
| Q1 | |
| Q2 | |
| Q3 | |
| Q4 | |
| 2025 | 127,658.15 |
| Q1 | 24,861.05 |
| Q2 | 38,624.30 |
| Q3 | 34,912.80 |
| Q4 | 29,260.00 |
| Total | 127,658.15 |
Last updated 10 November 2026
Opening the exercise…