A Power BI report uses a measure that calculates Year-over-Year sales growth. Users report that the measure shows incorrect values for January 2024 when compared to January 2023. The data model contains a Date table with a continuous date range from January 1, 2020 to December 31, 2024. Which DAX function is most likely causing the issue?
Trap 1: DATEADD
DATEADD('Date'[Date], -1, YEAR) shifts each selected date by exactly 365 or 366 days, preserving individual date values rather than calendar month boundaries. While this can work for daily or continuous data, a month-level visual may show mismatched day-to-day alignment, such as comparing February/2024 with February/2023, and any missing dates in the Date table become excluded from the result. Since the report is measuring the same period last year, DATEADD is less likely to be the root cause when the expected behavior is calendar-month alignment.
Trap 2: SAMEPERIODLASTYEAR
SAMEPERIODLASTYEAR is the most likely cause because it returns the same period from the previous year, but if the Date table lacks data for the entire previous period, it can produce incorrect results for month-over-month comparisons.
Trap 3: PREVIOUSYEAR
PREVIOUSYEAR('Date'[Date]) entirely ignores the active month or quarter filter and returns all dates from January 1 to December 31 of the prior year. In a month-level visual, this means each row would receive the same full-year previous-year value, so the year-over-year calculation would compare a single month to a sum of twelve months. That behavior is clearly incompatible with the required same-period comparison, making it an unlikely cause when the symptom is inconsistent month-over-month differences.
- A
PARALLELPERIOD
PARALLELPERIOD('Date'[Date], -1, YEAR) does not preserve the current filtering granularity; it shifts the entire set of dates to the previous full year at the level defined by the period argument. When the visual is filtered to a single month, this function returns the whole previous year, not the same month one year earlier, so the measure would produce an inflated year-over-year total. Thus it is an incorrect choice for a same-period comparison.
- B
DATEADD
Why wrong: DATEADD('Date'[Date], -1, YEAR) shifts each selected date by exactly 365 or 366 days, preserving individual date values rather than calendar month boundaries. While this can work for daily or continuous data, a month-level visual may show mismatched day-to-day alignment, such as comparing February/2024 with February/2023, and any missing dates in the Date table become excluded from the result. Since the report is measuring the same period last year, DATEADD is less likely to be the root cause when the expected behavior is calendar-month alignment.
- C
SAMEPERIODLASTYEAR
Why wrong: SAMEPERIODLASTYEAR is the most likely cause because it returns the same period from the previous year, but if the Date table lacks data for the entire previous period, it can produce incorrect results for month-over-month comparisons.
- D
PREVIOUSYEAR
Why wrong: PREVIOUSYEAR('Date'[Date]) entirely ignores the active month or quarter filter and returns all dates from January 1 to December 31 of the prior year. In a month-level visual, this means each row would receive the same full-year previous-year value, so the year-over-year calculation would compare a single month to a sum of twelve months. That behavior is clearly incompatible with the required same-period comparison, making it an unlikely cause when the symptom is inconsistent month-over-month differences.