SAMEPERIODLASTYEAR in Power BI: Why it breaks, and what actually fixes it

SAMEPERIODLASTYEAR in Power BI: Why it breaks, and what actually fixes it

Admin
July 29, 2026

If you've built more than a handful of Power BI reports, you've reached for SAMEPERIODLASTYEAR — and at some point stared at a blank cell wondering why it stopped working the moment you added it to a measure. You're not doing anything wrong. The cases where it quietly fails are rarely covered in the intro tutorials.

Quick answer

SAMEPERIODLASTYEAR shifts filter-context dates back exactly one year to build YoY comparisons — but it breaks in four common situations:

Need a comparison interval other than one year (month, quarter) — use DATEADD
Date table isn't contiguous — build a proper Calendar table, or filter manually
Using a fiscal or retail calendar, not standard Gregorian — try Calendar-based Time Intelligence (new, preview)
An incomplete current period causes "phantom" prior-year data on charts — wrap with an ISBLANK check
01

How SAMEPERIODLASTYEAR actually works

SAMEPERIODLASTYEAR takes the dates currently in filter context and shifts every one of them back exactly one year, then lets CALCULATE re-evaluate your measure against that shifted set of dates.

DAXRevenue LY
Revenue LY =
CALCULATE (
    [Total Revenue],
    SAMEPERIODLASTYEAR ( 'Calendar'[Date] )
)

That's why it's context-sensitive: at the year level it returns last year's total, at the month level the same month last year, at the day level the same calendar day last year — as long as your model matches the assumptions it was built on.

THIS YEAR (FILTER CONTEXT)
Jan 2026 – Dec 2026
SAMEPERIODLASTYEAR RETURNS
Jan 2025 – Dec 2025 (shifted −1 year)
SAMEPERIODLASTYEAR shifts the entire current date filter back one year, then re-evaluates the measure against those shifted dates.
02

Four situations where it falls short

2.1It only shifts by exactly one year

There's no parameter for "one quarter back" or "one month back." If your dashboard needs MoM or QoQ comparisons alongside YoY, you're forced into a different function for each — usually meaning several time-intelligence patterns living in the same model.

2.2It requires a proper, continuous date table

This is the one that trips up the most people. SAMEPERIODLASTYEAR isn't designed to run directly against a transaction table — it needs a dedicated calendar table where the date column is contiguous (no gaps) and unique (no duplicates).

✓ A DEDICATED CALENDAR TABLE — EVERY DAY PRESENT
Mon 6
Tue 7
Wed 8
Thu 9
Fri 10
Sat 11
✕ FILTERING A TRANSACTION TABLE DIRECTLY — ROWS MISSING ON NO-SALE DAYS
Mon 6
missing
Wed 8
missing
missing
Sat 11
"Missing" = no row exists for that date because there were no transactions that day — the date-shift logic can't find it, so results come back blank or wrong.
A dedicated calendar table has every date. A transaction table only has rows for days something actually happened.

2.3It only understands the Gregorian calendar

Fiscal years that don't start in January, 4-4-5 or 4-5-4 retail calendars, ISO weeks — none of these are native to SAMEPERIODLASTYEAR. Until recently, the only fix was a custom fiscal calendar table with manual FILTER / EDATE logic on top — messy, and easy to get subtly wrong.

2.4It creates "phantom" data for incomplete periods

Mid-month, when this year's measure is still blank for the rest of the month, SAMEPERIODLASTYEAR happily returns last year's full-month value anyway — so the "this year" line on a chart stops early while the "last year" line keeps going, reading like a sudden drop.

THIS YEAR — STOPS HERE (NO DATA YET)
TODAY
LAST YEAR — KEEPS GOING
This year — stops (no data yet)Last year — keeps goingToday's date
Without a blank-check, an unfinished current period makes the prior-year line look like it's pulling ahead — a false signal.

The fix is a check that returns blank whenever the current period has no data yet:

DAXRevenue LY (safe)
Revenue LY (safe) =
IF (
    ISBLANK ( [Total Revenue] ),
    BLANK (),
    CALCULATE ( [Total Revenue], SAMEPERIODLASTYEAR ( 'Calendar'[Date] ) )
)
03

Which function should you use instead

Each limitation above maps to a specific fix:

DATEADD
Need a period other than exactly one year back (last month, last quarter)
Accepts an interval parameter (DAY, MONTH, QUARTER, YEAR) — one function covers every shift you need
PARALLELPERIOD
Need the comparison to always span a whole period, no matter how many days it contains
Returns the entire prior period (e.g. all of last February) rather than a day-for-day shift
FILTER + EDATE
Calendar table isn't continuous, or you're stuck filtering a transaction table directly
Manual pattern that doesn't depend on the structural assumptions classic functions require
Calendar-based
Need fiscal year, retail 4-4-5/4-5-4, ISO, or week-based comparisons
Purpose-built for non-Gregorian calendars — see next section
04

A newer option for fiscal calendars

In the September 2025 release, Power BI Desktop introduced Enhanced DAX Time Intelligence — still in public preview — which targets the Gregorian-only gap directly. Instead of assuming a standard January–December calendar, you explicitly define a "calendar" on your date table by mapping its columns to categories like year, quarter, month, week, and date. That calendar can then be referenced inside familiar functions, including SAMEPERIODLASTYEAR and TOTALYTD.

Works with Gregorian, shifted Gregorian, retail (445/454/544), 13-month, and other non-standard calendars
Continuous date tables are still recommended, but sparse date tables are now supported
Adds new week-based functions, like TOTALWTD, that classic time intelligence never had
Needs at least the September 2025 build of Power BI Desktop, enabled under Options → Preview features
!
Worth knowing

It's still a preview feature with its own setup checklist — a custom calendar to define, a build requirement, a manual toggle. Useful, but not exactly a five-minute fix, and it still doesn't touch the other three limitations above.

✦ What we noticed building Flexa Tables
05

A simpler path for everyday variance charts

Everything above is a lot of DAX just to answer one question: how does this period compare to the same period before? Fair enough — most of the time, that's not something worth hand-rolling from scratch.

It's why variance comparisons are a built-in setting in Flexa Tables, rather than something you wire up with measures. You pick the base period and the comparison period from a field list, choose what to calculate — variance, variance %, or ratio — and the visual handles the rest, including the blank-period edge case from section 2.4.

Year-over-Year Total Revenue Variance by Product Category
Category20242025ΔVar
Bike Racks$22.7K$36.2K-$13.5K
Bottles & Cages$67.4K$107.7K-$40.3K
Helmets$131.0K$205.8K-$74.8K
Jerseys$0$45.0K+$45.0K
Total$569.8K$906.7K-$408.0K
Compared by
Year
Select calculations
ΔVar
ΔVar%
Ratio
Illustrative recreation of the Flexa Tables variance panel — pick the compared field and calculation type, no measures required.
Writing it in DAX
Choose DATEADD vs. PARALLELPERIOD, verify a contiguous calendar table, add a blank-check, repeat per variance type
In Flexa Tables
Pick base year, comparison year, and calculation type from the panel — done

It's not a replacement for understanding time intelligence — the concepts above still matter for anything custom. But for the everyday case of putting a YoY, MoM, or DoD column next to your numbers, it saves you from re-deriving all of section 2 every time.

See Flexa Tables in the Power BI marketplace →
06

Frequently asked

Why does my SAMEPERIODLASTYEAR measure return blank?

Usually the measure is filtered against a transaction table instead of a proper calendar table, the date table has gaps or duplicate dates, or the date column isn't marked as a Date table in the model.

What's the difference between SAMEPERIODLASTYEAR and DATEADD?

SAMEPERIODLASTYEAR always shifts exactly one year back. DATEADD takes an interval parameter (day, month, quarter, year), so it covers any period-over-period comparison, not just YoY.

Can SAMEPERIODLASTYEAR be used with a fiscal year calendar?

Not natively — it assumes standard Gregorian. For fiscal or retail calendars, either build a custom fiscal date table with manual DAX, or use Power BI's calendar-based time intelligence (preview, September 2025 onward).

Does SAMEPERIODLASTYEAR require a Date table?

Yes — a contiguous, unique date column, ideally marked as a Date table in the model settings.

facebooklinkedintwittermail
previous post
next post