Courseiva

PL-300 SAMEPERIODLASTYEAR Practice Question

You need to create a measure that calculates the year-over-year growth of sales. Which DAX function should you use?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

SAMEPERIODLASTYEAR

SAMEPERIODLASTYEAR (option B) is correct because it returns a table of dates shifted exactly one year back from the dates in the current filter context, which is precisely what you need to compare this year's sales against the same period last year for a year-over-year growth measure. It is a time-intelligence function designed for this purpose and works on a marked date table, letting you write something like CALCULATE([Sales], SAMEPERIODLASTYEAR(Dates[Date])). DATEADD is more flexible (it shifts by any interval, e.g., -1 YEAR) but is not the dedicated same-period comparison function, and it can behave differently at partial periods. PARALLELPERIOD shifts to a full parallel period (e.g., the entire previous year or quarter) rather than the same portion of the period, so it would not align day-for-day. PREVIOUSYEAR returns the whole previous calendar year regardless of the current period's partial span, which also breaks the same-period alignment needed for accurate YoY growth.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    DATEADD

    Why it's wrong here

    DATEADD shifts a date context by a specified interval, returning a table of dates, but it does not directly compute a ratio between two time periods. For year-over-year growth, you need a function like SAMEPERIODLASTYEAR to isolate the prior period, then divide the difference by the prior value. DATEADD is tempting because it can shift dates for comparison, but it lacks the built-in aggregation logic required to calculate a percentage change.

  • ✓

    SAMEPERIODLASTYEAR

    Why this is correct

    SAMEPERIODLASTYEAR returns a contiguous set of dates shifted exactly one year back from the current filter context, preserving the precise date range of the reporting period. This makes it possible to compare, for example, current month-to-date or quarter-to-date sales directly with the same calendar segment in the previous year, which is the foundation of a year-over-year growth measure. For instance, the measure YoY Growth = DIVIDE([Sales] - CALCULATE([Sales], SAMEPERIODLASTYEAR(Date[Date])), CALCULATE([Sales], SAMEPERIODLASTYEAR(Date[Date]))) yields the required percentage change.

  • ✗

    PARALLELPERIOD

    Why it's wrong here

    PARALLELPERIOD returns values from a prior period of the same length (e.g., the same month in the previous year) but does not shift the date context to the complete prior year; it returns a single period’s value, not a full-year comparison. It is tempting because it can retrieve a prior-year value, which seems to enable year-over-year calculation, and would be correct if the requirement were to compare a single month or quarter to its parallel period in the prior year.

  • ✗

    PREVIOUSYEAR

    Why it's wrong here

    PREVIOUSYEAR always returns the entire previous calendar year relative to the current date context, rather than the same relative portion of that year. If the current filter context is, say, only the first quarter of 2025, PREVIOUSYEAR would return all 365 days of 2024, making the 'previous' value incomparable in length and period. This function is appropriate for annual comparisons such as total sales for 2025 vs 2024, but it cannot directly support a year-over-year calculation for sub-annual periods.

About these practice questions

One of 524 original PL-300 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

3 more ways this is tested on PL-300

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. You need to create a measure that calculates year-over-year growth percentage. Which DAX function should you use?

easy
  • A.DATEADD
  • B.DATESYTD
  • ✓ C.SAMEPERIODLASTYEAR
  • D.PARALLELPERIOD

Why C: SAMEPERIODLASTYEAR is the most direct and semantically clear function for year-over-year comparisons because it returns the same period in the prior year without requiring complex interval arguments. While DATEADD('Date'[Date], -1, YEAR) produces the same result, SAMEPERIODLASTYEAR is specifically designed for this purpose and is easier to read. PARALLELPERIOD, on the other hand, shifts entire periods and may not align with the current granularity (e.g., a monthly context would return the full prior year).

Variation 2. You need to create a measure that calculates the year-over-year growth percentage for sales. Which DAX function combination is most appropriate?

easy
  • A.CALCULATE with DATEADD and SUM
  • ✓ B.CALCULATE with SAMEPERIODLASTYEAR and DIVIDE
  • C.TOTALYTD and DIVIDE
  • D.PREVIOUSMONTH and SUM

Why B: Option B is correct because SAMEPERIODLASTYEAR returns the equivalent date range shifted back exactly one year, and wrapping it in CALCULATE lets you evaluate the prior-year sales in the current row context; DIVIDE then safely computes the growth ratio (Current − PriorYear) / PriorYear without divide-by-zero errors. This is the standard DAX pattern for year-over-year percentage growth in Power BI and Analysis Services Tabular models. Option A is less appropriate because DATEADD requires an explicit number and interval and is more error-prone for a simple YoY shift, while SAMEPERIODLASTYEAR is purpose-built for this. Option C's TOTALYTD computes a year-to-date aggregate, not a prior-year comparison, so it cannot produce YoY growth. Option D's PREVIOUSMONTH shifts by one month, not one year, so it answers a month-over-month question instead.

Variation 3. You need to create a measure that calculates the year-over-year growth percentage for sales. Which DAX function should you use?

easy
  • A.DATEADD
  • B.PARALLELPERIOD
  • ✓ C.SAMEPERIODLASTYEAR
  • D.PREVIOUSYEAR

Why C: The SAMEPERIODLASTYEAR function is the correct choice for calculating year-over-year growth because it shifts the current filter context back by one year, returning a set of dates exactly one year prior. This allows you to compute the prior year's sales and then derive the growth percentage using a formula like (Current Sales - Prior Year Sales) / Prior Year Sales.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PL-300 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PL-300 exam.