PL-300 Model the data Practice Question
You have a Power BI model with a 'Date' table marked as a date table. You need to create a measure that calculates the running total of sales over the last 12 months. Which DAX function should you use?
⚠ Common exam trap
Many exam-takers confuse DATESYTD (which is for year-to-date, not rolling) with a trailing 12-month calculation, or they mistakenly think PREVIOUSYEAR can handle a dynamic window, when in fact it only returns a fixed prior calendar 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
✓
DATESINPERIOD
DATESINPERIOD, is correct because it allows you to define a dynamic window of dates—specifically, the last 12 months ending with the latest date in the current filter context. When used with a measure like CALCULATE(SUM(Sales[Amount]), DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -12, MONTH)), it shifts the date range backward by 12 months from the last visible date, making it ideal for a rolling 12-month total. The 'Date' table being marked as a date table ensures that time intelligence functions respect the continuous date range.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
PREVIOUSYEAR
Why it's wrong here
PREVIOUSYEAR is designed to return a table of dates for the entire previous calendar year relative to the current filter context. It shifts the whole year back by one year, so it always includes dates from January 1 to December 31, not a rolling 12-month window anchored to the latest date. This means it will either include dates that are more than 12 months old or omit recent months, making it unsuitable for a last-12-months calculation.
- ✗
DATESYTD
Why it's wrong here
DATESYTD returns a contiguous set of dates from the start of the current calendar year up to the latest date in the current filter context. It is specifically anchored to the year boundary and never extends into the prior year, so it can never represent a true trailing 12-month period unless the current date happens to be December 31. In most scenarios, it yields only the partial year-to-date range, missing any months that occurred before January 1, which is why it cannot produce the desired rolling window.
- ✓
DATESINPERIOD
Why this is correct
DATESINPERIOD is a general-purpose time intelligence function that returns a table of dates from an initial start date and moves a specified number of intervals (such as -12 months) into the past or future. When used with a start date of the current context date and an interval of -12 MONTH, it dynamically constructs the exact trailing 12-month period, including all dates from the current date going back one year. This makes it the correct choice for a last-12-months measure because it directly defines the rolling window based on the current filter context.
- ✗
DATEADD
Why it's wrong here
DATEADD shifts a given set of dates by one or more specified intervals, but it does not itself expand or restrict the range to a 12-month window. If used alone, it merely moves every date in the current filter context back by a fixed interval, leaving the overall date range unchanged; for example, a quarter-to-date filter would become the same quarter in the prior year, not the last 12 months. To create a rolling 12-month period, you would need to combine DATEADD with additional functions to define a starting point and a length, so it is not the correct standalone solution.
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.