WMA Hub

Tools / DAX library

Year-over-year change %

Compare this period with the same period last year and show the change as a percentage.

Time intelligence · Beginner · Not yet reviewed

Sales YoY % =
VAR CurrentSales = [Total Sales]
VAR PriorYearSales =
    CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Date'[Date]))
RETURN
    DIVIDE(CurrentSales - PriorYearSales, PriorYearSales)

How it works

SAMEPERIODLASTYEAR shifts every date in the current filter context back one year. CALCULATE then evaluates [Total Sales] for those shifted dates, which gives last year's value for the same period.

The result is (current - prior) / prior. DIVIDE returns blank instead of an error when the prior-year value is zero or blank, for example for the first year of data.

Format the measure as a percentage in Measure tools.

What your model needs

- A date table named 'Date' with one row per day and no gaps, marked as the date table in Power BI (Table tools > Mark as date table). - A one-to-many relationship from 'Date'[Date] to the date column of the Sales table (for example Sales[OrderDate]). - Total Sales = SUM(Sales[Amount]) (called [Total Sales]).

Small example

Input data

Year | Total Sales
2023 | 100,000
2024 | 120,000

Expected result

Year | Sales YoY %
2023 | (blank)
2024 | 20.0%

Common mistakes and limitations

- Using the date column of the Sales table instead of 'Date'[Date]. Time-intelligence functions need the continuous date table. - A date table with missing days, or one that is not marked as a date table, gives wrong or blank results. - During a year that is only partly over, this compares the partial year with the same dates last year only if the visual is filtered to those dates; with a year-level visual it compares against the full prior year.

Tags: year-over-year, SAMEPERIODLASTYEAR, time intelligence, growth