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
EntryIDDateCostCenterIDAccountIDAmount
123 Jan 2025300400088400
222 Jan 20253004000132600
312 Jan 2025200500036176
44 Jan 202560050005253.5
521 Jan 2025100600013276.2
630 Jan 202510060009613.8
716 Jan 2025200600049220
820 Jan 2025300600025440
929 Jan 2025400600012875
1029 Jan 2025500600017205
1110 Jan 202560060005045.04
1214 Jan 202560060004656.96

Showing the first 12 of 535 rows.

Measures: [Total Actual]

Budget 432 rows, 4 columns
DateCostCenterIDAccountIDAmount
1 Jan 20253004000221000
1 Jan 2025200500032300
1 Jan 202560050005530
1 Jan 2025100600021000
1 Jan 2025200600046000
1 Jan 2025300600024000
1 Jan 2025400600012500
1 Jan 2025500600015500
1 Jan 202560060009800
1 Jan 202510063004200
1 Jan 202520063007800
1 Jan 202560063003600

Showing the first 12 of 432 rows.

Measures: [Total Budget]

CostCenter 6 rows, 3 columns
CostCenterIDCostCenterDivision
100AdministrationAdministration
200ProductionOperations
300SalesSales
400MarketingSales
500ITAdministration
600WarehouseOperations
Account 7 rows, 4 columns
AccountIDAccountAccountTypeAccountGroup
4000RevenueIncomeRevenue
5000MaterialsExpenseMaterials
6000Salaries and WagesExpensePersonnel
6300RentExpenseOperating
6500TravelExpenseOperating
6800AdvertisingExpenseOperating
6900Other ExpensesExpenseOperating
Date 730 rows, 4 columns
DateYearMonthMonthName
1 Jan 202520251Jan
2 Jan 202520251Jan
3 Jan 202520251Jan
4 Jan 202520251Jan
5 Jan 202520251Jan
6 Jan 202520251Jan
7 Jan 202520251Jan
8 Jan 202520251Jan
9 Jan 202520251Jan
10 Jan 202520251Jan
11 Jan 202520251Jan
12 Jan 202520251Jan

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
EntryIDDateCostCenterIDAccountIDAmount
123 Jan 2025300400088400
222 Jan 20253004000132600
312 Jan 2025200500036176
44 Jan 202560050005253.5
521 Jan 2025100600013276.2
630 Jan 202510060009613.8
716 Jan 2025200600049220
820 Jan 2025300600025440
929 Jan 2025400600012875
1029 Jan 2025500600017205
1110 Jan 202560060005045.04
1214 Jan 202560060004656.96

Showing the first 12 of 535 rows.

Measures: [Total Actual], [Actual Prior Year]

Budget 432 rows, 4 columns
DateCostCenterIDAccountIDAmount
1 Jan 20253004000221000
1 Jan 2025200500032300
1 Jan 202560050005530
1 Jan 2025100600021000
1 Jan 2025200600046000
1 Jan 2025300600024000
1 Jan 2025400600012500
1 Jan 2025500600015500
1 Jan 202560060009800
1 Jan 202510063004200
1 Jan 202520063007800
1 Jan 202560063003600

Showing the first 12 of 432 rows.

Measures: [Total Budget]

CostCenter 6 rows, 3 columns
CostCenterIDCostCenterDivision
100AdministrationAdministration
200ProductionOperations
300SalesSales
400MarketingSales
500ITAdministration
600WarehouseOperations
Account 7 rows, 4 columns
AccountIDAccountAccountTypeAccountGroup
4000RevenueIncomeRevenue
5000MaterialsExpenseMaterials
6000Salaries and WagesExpensePersonnel
6300RentExpenseOperating
6500TravelExpenseOperating
6800AdvertisingExpenseOperating
6900Other ExpensesExpenseOperating
Date 730 rows, 4 columns
DateYearMonthMonthName
1 Jan 202520251Jan
2 Jan 202520251Jan
3 Jan 202520251Jan
4 Jan 202520251Jan
5 Jan 202520251Jan
6 Jan 202520251Jan
7 Jan 202520251Jan
8 Jan 202520251Jan
9 Jan 202520251Jan
10 Jan 202520251Jan
11 Jan 202520251Jan
12 Jan 202520251Jan

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.

Next: case 5, RAG status and ranking

Every cost center gets a RAG status, and the biggest overruns come first.

Go to case 5

Back to case 3 or the course overview.

Write to us

Choose language

Select your preferred language