PL-300 DATESINPERIOD Practice Question
A data analyst creates a Power BI report that uses a date table with a continuous date range. They want to calculate the running total of sales over the last 12 months, ending on the last date in the current filter context. Which DAX expression should they use?
⚠ Common exam trap
Candidates often choose DATESBETWEEN with 365 days (Option A) thinking it simplifies the calculation, but they overlook the leap year issue. DATESINPERIOD (Option B) is the correct function for a precise rolling 12-month period as it uses month boundaries rather than a fixed number of days.
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
✓
CALCULATE(SUM(Sales[Amount]), DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -12, MONTH))
DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -12, MONTH) returns a contiguous set of dates from 12 months before the last date in the current filter context up to that last date, providing an exact 12-month window. This function handles month boundaries correctly and is the standard way to calculate rolling 12-month totals in DAX. Option A uses 365 days, which can be imprecise due to leap years.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
CALCULATE(SUM(Sales[Amount]), DATESBETWEEN('Date'[Date], MAX('Date'[Date]) - 365, MAX('Date'[Date])))
Why it's wrong here
This approach uses DATESBETWEEN with a fixed 365-day subtraction from MAX('Date'[Date]), which is problematic because it treats a year as exactly 365 days and ignores the extra day in leap years. On leap years (or when the period spans a leap day), the calculation will drift by one day, causing the window to start on the wrong date and potentially include or exclude a day's sales. DATESINPERIOD with MONTH handles varying month lengths and leap years cleanly by working at month granularity.
- ✓
CALCULATE(SUM(Sales[Amount]), DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -12, MONTH))
Why this is correct
DATESINPERIOD is the correct time-intelligence function here because it returns a contiguous interval ending at MAX('Date'[Date]) and extending back 12 full calendar months, respecting month boundaries rather than fixed day counts. With -12 and MONTH, the filter context established by CALCULATE adjusts the Sales[Amount] summation to include exactly the trailing 12 months relative to the latest visible date, which is exactly what a rolling 12-month total requires.
- ✗
TOTALMTD(SUM(Sales[Amount]), 'Date'[Date])
Why it's wrong here
TOTALMTD is a month-to-date aggregator: it sums Sales[Amount] only from the beginning of the current month through the last visible date in the current filter context. This yields a partial-month cumulative figure that resets every month, so it cannot produce a 12-month rolling total. To capture a trailing year, you need a filter that spans multiple months, not just the current month's elapsed days.
- ✗
CALCULATE(SUM(Sales[Amount]), DATESYTD('Date'[Date]))
Why it's wrong here
DATESYTD evaluates the year-to-date total, meaning it sums Sales[Amount] from only January 1 through the last visible date in the current year, depending on the year-end date set in the date table. This is a calendar-year cumulative measure, not a rolling 12-month measure, because the start point resets every January 1 rather than following a trailing window based on the current filter context. Therefore it will not reflect the last 12 months from any arbitrary date.
Go deeper
Related to this question
About these practice questions
This PL-300 question is part of Courseiva's 217-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.