Power BI (DAX) Guide · Prompt: “Write a Power BI DAX measure for YoY revenue growth percentage using SAMEPERIODLASTYEAR and DIVIDE”

Calculate Year-over-Year Growth with DAX SAMEPERIODLASTYEAR

Verified by LiveFormulaLab Engineering Team • Updated November 2026

Compute Year-over-Year (YoY) revenue growth percentage safely in Power BI using SAMEPERIODLASTYEAR, CALCULATE, and DIVIDE.

Verified Power BI (DAX) Syntax

DIVIDE([Total Revenue] - CALCULATE([Total Revenue], SAMEPERIODLASTYEAR('Date'[Date])), CALCULATE([Total Revenue], SAMEPERIODLASTYEAR('Date'[Date])), 0)

How This Formula Works (Step-by-Step)

Time-intelligence comparisons in Power BI rely on a continuous marked Date table linked to your fact table.

Step 1: CALCULATE([Total Revenue], SAMEPERIODLASTYEAR('Date'[Date])) shifts the current month, quarter, or year selection back by one calendar year.

Step 2: DIVIDE subtracts prior-year revenue from current revenue and divides by prior-year revenue while safely returning 0 when prior-year data is missing.

Formula Syntax & Arguments Breakdown

Shifts the active report date selection back 12 months via CALCULATE + SAMEPERIODLASTYEAR, then computes safe percentage delta with DIVIDE.

Argument / ClauseRequirementData TypeRole & Behavior
[Total Revenue]RequiredBase MeasureCurrent-period revenue measure evaluated under the active chart/slicer date context.
SAMEPERIODLASTYEAR('Date'[Date])RequiredTime-Intelligence FilterShifts every selected day, month, quarter, or year back exactly one calendar year.
alternate_result (0 or BLANK())OptionalDIVIDE FallbackReturned when prior-year revenue is 0 or missing so visuals never throw Infinity.

3 Real-World Use Cases

  • Tracking monthly SaaS MRR growth versus the same month last year.
  • Evaluating seasonal retail Q4 sales velocity year-over-year.
  • Highlighting underperforming regions in Power BI matrix conditional formatting.

Cross-Platform Equivalents

Excel
=(B2-C2)/C2
SQL
SELECT (SUM(current_rev) - SUM(prior_rev)) / NULLIF(SUM(prior_rev), 0) AS yoy_growth FROM quarterly_rev;
Python Pandas
(df['CurrentRev'].sum() - df['PriorRev'].sum()) / df['PriorRev'].sum()
Power BI (DAX)
DIVIDE([Total Revenue] - CALCULATE([Total Revenue], SAMEPERIODLASTYEAR('Date'[Date])), CALCULATE([Total Revenue], SAMEPERIODLASTYEAR('Date'[Date])), 0)

Common Mistakes & Pro Tips

Pitfalls & How to Fix Them

  • Mistake: Passing Sales[OrderDate] directly instead of a dedicated marked Date table causes gaps and silent blanks.

    Fix: Always build a continuous Calendar table covering full years Jan 1–Dec 31, mark it as Date Table, and pass 'Date'[Date].

  • Mistake: Displaying YoY growth for an incomplete current month compares 10 days of November this year against 30 days last year.

    Fix: Cap the prior-year period at the latest transaction date or create a Month-to-Date (MTD) comparison measure.

  • Mistake: Using "/" instead of DIVIDE() displays Infinity on brand-new products with zero prior-year sales.

    Fix: Always wrap ratio measures in DIVIDE(Current - Prior, Prior, BLANK()).

Engineering Pro Tips

  • Store prior-year revenue in a VAR PriorRev = CALCULATE([Total Revenue], SAMEPERIODLASTYEAR('Date'[Date])) variable so DAX evaluates it only once instead of twice.
  • Use DATEADD('Date'[Date], -1, QUARTER) with the exact same VAR + DIVIDE structure for Quarter-over-Quarter (QoQ) KPIs.
  • Format the resulting YoY measure as Percentage (0.0%) in Power BI Model view.

Frequently Asked Questions

Why does SAMEPERIODLASTYEAR return blank or an error on my dataset?
SAMEPERIODLASTYEAR requires a contiguous Date table marked as Date Table with no missing calendar days between start and end dates.
Should I use DATEADD instead of SAMEPERIODLASTYEAR?
DATEADD('Date'[Date], -1, YEAR) produces identical results and also lets you shift by quarters, months, or days.
Why use DIVIDE instead of the "/" operator?
DIVIDE automatically handles zero or BLANK denominators without returning Infinity or breaking Power BI visuals.

Related Formulas & Guides