PL-300 Model the data Practice Question
A data model contains a Date table and a Sales table. You need to create a measure that calculates total sales for the previous year. Which DAX function should you use?
⚠ Common exam trap
Test-takers frequently confuse SAMEPERIODLASTYEAR with PREVIOUSYEAR, not realizing that PREVIOUSYEAR returns the entire previous year regardless of the current filter granularity, while SAMEPERIODLASTYEAR shifts the exact same period (e.g., month, quarter) back by one year.
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 is the correct DAX function for calculating total sales for the previous year because it returns a set of dates shifted back by exactly one year while preserving the current filter context (e.g., month, quarter). This function is specifically designed for year-over-year comparisons and works seamlessly with a Date table marked as a date table in the model. Option B: DATEADD can also shift dates by one year but requires specifying the interval and number of intervals, making it less direct for this specific requirement. Option C: PARALLELPERIOD returns the entire parallel period (e.g., full year) regardless of current granularity, which does not preserve the same relative period. Option D: PREVIOUSYEAR returns the entire previous year, not the same period shifted back, so it does not maintain month-over-month or quarter-over-quarter comparisons.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
SAMEPERIODLASTYEAR
Why this is correct
SAMEPERIODLASTYEAR is the correct time intelligence function for year-over-year comparisons. It takes the current filter selection — whether it is a single date, a month, a quarter, or a custom range — and returns the exact corresponding date range from the previous calendar year, preserving the number of days and the shape of the selection. This precision makes it the standard DAX approach for computing previous-year totals, especially when you need the prior year to match the current period on a day-for-day or period-for-period basis.
- ✗
DATEADD
Why it's wrong here
DATEADD is a generic time-shifting function that moves a set of dates forward or backward by a specified number of intervals, such as 1 year. While DATEADD(...,-1,YEAR) can produce a previous-year period, the function is not purpose-built for same-period-last-year logic; it requires you to explicitly define the interval and count. Moreover, DATEADD can shift by days, months, quarters, or years, so it is less specific than SAMEPERIODLASTYEAR, and its behavior with irregular ranges may not align exactly with the previous year's corresponding calendar period. Therefore, it is a valid but overly broad tool when the intended result is a direct year-over-year match.
- ✗
PARALLELPERIOD
Why it's wrong here
PARALLELPERIOD shifts a period by a given number of intervals, but it always returns the complete calendar period, not the exact same offset date range. For instance, a partial month in the current year will be shifted to the entire previous month, not the equivalent day portion of that month. This makes it unsuitable for same-period-last-year calculations because it changes the granularity and shape of the comparison range, unlike SAMEPERIODLASTYEAR which preserves the relative position within the period. It is also not specifically restricted to years, so it fails to address the question's exact requirement.
- ✗
PREVIOUSYEAR
Why it's wrong here
PREVIOUSYEAR is not a recognized DAX function, so using it would generate a syntax or formula error. It is easy to confuse with the documented PREVIOUSMONTH or PREVIOUSQUARTER functions, but DAX has no PREVIOUSYEAR counterpart. The correct function for returning dates from the previous year in a time-intelligence context is SAMEPERIODLASTYEAR, which aligns the entire current date range with its year-over-year equivalent. Therefore, any attempt to reference PREVIOUSYEAR in a measure or calculated table will fail before it can produce a result.
Go deeper
Related to this question
About these practice questions
Courseiva writes every PL-300 question from scratch — 217 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
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.