Case 4: prior-year comparison in Power BI
Besides the budget, the prior year is the second benchmark for every cost center. You bring in the costs of the same period one year earlier and calculate how many percent they rose or fell.
In short: CALCULATE([Total Actual], SAMEPERIODLASTYEAR('Date'[Date])) calculates [Total Actual] for the same days one year earlier. The change is DIVIDE([Total Actual] - [Actual Prior Year], [Actual Prior Year]), with the prior year as the base.
The situation
The 2026 annual report shows the costs per cost center, filtered to the account type Expense. For every row, management asks: and last year? Instead of placing a second matrix for 2025 next to it, a measure calculates the prior year in the same row.
Task 1: last year's actual
Task Besides the budget, the prior year is the second benchmark. Create the measure "Actual Prior Year": [Total Actual] for the same period one year earlier. The matrix is filtered to 2026, so the measure should show the 2025 costs.
Actual 535 rows, 5 columns
| EntryID | Date | CostCenterID | AccountID | Amount |
|---|---|---|---|---|
| 1 | 23 Jan 2025 | 300 | 4000 | 88400 |
| 2 | 22 Jan 2025 | 300 | 4000 | 132600 |
| 3 | 12 Jan 2025 | 200 | 5000 | 36176 |
| 4 | 4 Jan 2025 | 600 | 5000 | 5253.5 |
| 5 | 21 Jan 2025 | 100 | 6000 | 13276.2 |
| 6 | 30 Jan 2025 | 100 | 6000 | 9613.8 |
| 7 | 16 Jan 2025 | 200 | 6000 | 49220 |
| 8 | 20 Jan 2025 | 300 | 6000 | 25440 |
| 9 | 29 Jan 2025 | 400 | 6000 | 12875 |
| 10 | 29 Jan 2025 | 500 | 6000 | 17205 |
| 11 | 10 Jan 2025 | 600 | 6000 | 5045.04 |
| 12 | 14 Jan 2025 | 600 | 6000 | 4656.96 |
Showing the first 12 of 535 rows.
Measures: [Total Actual]
Budget 432 rows, 4 columns
| Date | CostCenterID | AccountID | Amount |
|---|---|---|---|
| 1 Jan 2025 | 300 | 4000 | 221000 |
| 1 Jan 2025 | 200 | 5000 | 32300 |
| 1 Jan 2025 | 600 | 5000 | 5530 |
| 1 Jan 2025 | 100 | 6000 | 21000 |
| 1 Jan 2025 | 200 | 6000 | 46000 |
| 1 Jan 2025 | 300 | 6000 | 24000 |
| 1 Jan 2025 | 400 | 6000 | 12500 |
| 1 Jan 2025 | 500 | 6000 | 15500 |
| 1 Jan 2025 | 600 | 6000 | 9800 |
| 1 Jan 2025 | 100 | 6300 | 4200 |
| 1 Jan 2025 | 200 | 6300 | 7800 |
| 1 Jan 2025 | 600 | 6300 | 3600 |
Showing the first 12 of 432 rows.
Measures: [Total Budget]
CostCenter 6 rows, 3 columns
| CostCenterID | CostCenter | Division |
|---|---|---|
| 100 | Administration | Administration |
| 200 | Production | Operations |
| 300 | Sales | Sales |
| 400 | Marketing | Sales |
| 500 | IT | Administration |
| 600 | Warehouse | Operations |
Account 7 rows, 4 columns
| AccountID | Account | AccountType | AccountGroup |
|---|---|---|---|
| 4000 | Revenue | Income | Revenue |
| 5000 | Materials | Expense | Materials |
| 6000 | Salaries and Wages | Expense | Personnel |
| 6300 | Rent | Expense | Operating |
| 6500 | Travel | Expense | Operating |
| 6800 | Advertising | Expense | Operating |
| 6900 | Other Expenses | Expense | Operating |
Date 730 rows, 4 columns
| Date | Year | Month | MonthName |
|---|---|---|---|
| 1 Jan 2025 | 2025 | 1 | Jan |
| 2 Jan 2025 | 2025 | 1 | Jan |
| 3 Jan 2025 | 2025 | 1 | Jan |
| 4 Jan 2025 | 2025 | 1 | Jan |
| 5 Jan 2025 | 2025 | 1 | Jan |
| 6 Jan 2025 | 2025 | 1 | Jan |
| 7 Jan 2025 | 2025 | 1 | Jan |
| 8 Jan 2025 | 2025 | 1 | Jan |
| 9 Jan 2025 | 2025 | 1 | Jan |
| 10 Jan 2025 | 2025 | 1 | Jan |
| 11 Jan 2025 | 2025 | 1 | Jan |
| 12 Jan 2025 | 2025 | 1 | Jan |
Showing the first 12 of 730 rows.
SAMEPERIODLASTYEAR takes the days in the current filter and shifts them by one year. If a month is in the row, it becomes the same month of the prior year; if the whole year is in the filter, the whole prior year. More in the lesson on time intelligence.
Task 2: the change in percent
Task Create the measure "Change %": how much the costs changed compared with the prior year, so (actual minus actual prior year) divided by actual prior year. Use DIVIDE.
Actual 535 rows, 5 columns
| EntryID | Date | CostCenterID | AccountID | Amount |
|---|---|---|---|---|
| 1 | 23 Jan 2025 | 300 | 4000 | 88400 |
| 2 | 22 Jan 2025 | 300 | 4000 | 132600 |
| 3 | 12 Jan 2025 | 200 | 5000 | 36176 |
| 4 | 4 Jan 2025 | 600 | 5000 | 5253.5 |
| 5 | 21 Jan 2025 | 100 | 6000 | 13276.2 |
| 6 | 30 Jan 2025 | 100 | 6000 | 9613.8 |
| 7 | 16 Jan 2025 | 200 | 6000 | 49220 |
| 8 | 20 Jan 2025 | 300 | 6000 | 25440 |
| 9 | 29 Jan 2025 | 400 | 6000 | 12875 |
| 10 | 29 Jan 2025 | 500 | 6000 | 17205 |
| 11 | 10 Jan 2025 | 600 | 6000 | 5045.04 |
| 12 | 14 Jan 2025 | 600 | 6000 | 4656.96 |
Showing the first 12 of 535 rows.
Measures: [Total Actual], [Actual Prior Year]
Budget 432 rows, 4 columns
| Date | CostCenterID | AccountID | Amount |
|---|---|---|---|
| 1 Jan 2025 | 300 | 4000 | 221000 |
| 1 Jan 2025 | 200 | 5000 | 32300 |
| 1 Jan 2025 | 600 | 5000 | 5530 |
| 1 Jan 2025 | 100 | 6000 | 21000 |
| 1 Jan 2025 | 200 | 6000 | 46000 |
| 1 Jan 2025 | 300 | 6000 | 24000 |
| 1 Jan 2025 | 400 | 6000 | 12500 |
| 1 Jan 2025 | 500 | 6000 | 15500 |
| 1 Jan 2025 | 600 | 6000 | 9800 |
| 1 Jan 2025 | 100 | 6300 | 4200 |
| 1 Jan 2025 | 200 | 6300 | 7800 |
| 1 Jan 2025 | 600 | 6300 | 3600 |
Showing the first 12 of 432 rows.
Measures: [Total Budget]
CostCenter 6 rows, 3 columns
| CostCenterID | CostCenter | Division |
|---|---|---|
| 100 | Administration | Administration |
| 200 | Production | Operations |
| 300 | Sales | Sales |
| 400 | Marketing | Sales |
| 500 | IT | Administration |
| 600 | Warehouse | Operations |
Account 7 rows, 4 columns
| AccountID | Account | AccountType | AccountGroup |
|---|---|---|---|
| 4000 | Revenue | Income | Revenue |
| 5000 | Materials | Expense | Materials |
| 6000 | Salaries and Wages | Expense | Personnel |
| 6300 | Rent | Expense | Operating |
| 6500 | Travel | Expense | Operating |
| 6800 | Advertising | Expense | Operating |
| 6900 | Other Expenses | Expense | Operating |
Date 730 rows, 4 columns
| Date | Year | Month | MonthName |
|---|---|---|---|
| 1 Jan 2025 | 2025 | 1 | Jan |
| 2 Jan 2025 | 2025 | 1 | Jan |
| 3 Jan 2025 | 2025 | 1 | Jan |
| 4 Jan 2025 | 2025 | 1 | Jan |
| 5 Jan 2025 | 2025 | 1 | Jan |
| 6 Jan 2025 | 2025 | 1 | Jan |
| 7 Jan 2025 | 2025 | 1 | Jan |
| 8 Jan 2025 | 2025 | 1 | Jan |
| 9 Jan 2025 | 2025 | 1 | Jan |
| 10 Jan 2025 | 2025 | 1 | Jan |
| 11 Jan 2025 | 2025 | 1 | Jan |
| 12 Jan 2025 | 2025 | 1 | Jan |
Showing the first 12 of 730 rows.
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
The change is the counterpart of the variance from case 1, only with the prior year instead of the budget as the base. You build the same comparison for revenue in the year-over-year project of the main course.
Common mistakes
Year 2025 typed into the formula
CALCULATE([Total Actual], 'Date'[Year] = 2025) is only right while the report is set to 2026. Next year the measure still shows 2025. Check runs a different data set and reports that the result only matches by chance.
Change divided by the current year
The base is the prior year. Dividing by [Total Actual] gives -4.3% instead of -4.1% for Marketing.
In real Power BI
- If the current year is not over yet, an annual value compares twelve prior-year months with a few months of actuals. Compare year-to-date values instead:
CALCULATE([Actual YTD], SAMEPERIODLASTYEAR('Date'[Date])). - For a comparison with the previous month, use
DATEADD('Date'[Date], -1, MONTH)instead of SAMEPERIODLASTYEAR.
Check your result
- Task 1: Production had costs of 1,100,971.00 in 2025, all cost centers together 2,513,660.30.
- Task 2: Overall, costs rose by 1.3%, in Administration by 3.6%; Marketing is 4.1% below the prior year.
Back to case 3 or the course overview.