Courseiva

PL-300 Visualize and analyze the data Practice Question

You have a Power BI dataset that includes a 'Sales' table and a 'Calendar' table. You need to create a measure that calculates the running total of sales over the last 12 months, ending on the last date in the current filter context. 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

✓

DATESINPERIOD

DATESINPERIOD is the correct choice because it returns a table of dates spanning a specified number of intervals (e.g., -12 MONTH) ending on a given date, which is exactly what a rolling 12-month running total requires when combined with CALCULATE and SUM. In this scenario, you would write something like CALCULATE(SUM(Sales[Amount]), DATESINPERIOD('Calendar'[Date], MAX('Calendar'[Date]), -12, MONTH)), where MAX returns the last date in the current filter context. DATEADD shifts a date range by an interval but does not by itself produce a continuous 12-month window ending on the last date. PREVIOUSMONTH only returns the single prior month, not a 12-month span. DATESBETWEEN requires explicit start and end dates and does not automatically anchor to the last date in context with a rolling interval.

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 is a translation function: it takes the dates currently visible in the filter context and shifts every one of them by a fixed interval, such as -3 months. If the current filter context is a single month, you get only that month shifted backward, not a three-month sequence; if the current context is empty, DATEADD may return the entire shifted range, but that rarely matches a rolling-window measure. Thus, while you could wrap DATEADD in CALCULATE and combine with a range filter, it is not a one-call solution for 'previous three months'.

  • ✗

    PREVIOUSMONTH

    Why it's wrong here

    PREVIOUSMONTH returns a filtered date set of exactly the immediately preceding month, relative to the first date in the current filter context. For a measure that must aggregate sales over three months, this function cannot be scaled up: there is no 'PREVIOUSMONTHS' equivalent, and summing two or three of them through multiple CALCULATE expressions would both complicate the formula and violate the intended single-period logic. Because it inherently collapses to a one-month window, PREVIOUSMONTH is not suitable when the requirement explicitly specifies a multi-month period.

  • ✗

    DATESBETWEEN

    Why it's wrong here

    DATESBETWEEN does generate a contiguous date range, but it forces you to compute both the start and end dates yourself—for example, LASTDATE(Date) and EDATE(LASTDATE(Date), -3) + 1—as separate scalar arguments. That explicit boundary arithmetic introduces extra opportunities for off-by-one errors and makes the measure more verbose than necessary. DATESINPERIOD, by contrast, encapsulates the 'anchor date plus interval count' logic, which is exactly why DATESBETWEEN is not the preferred DAX function for a rolling period of a fixed length.

  • ✓

    DATESINPERIOD

    Why this is correct

    DATESINPERIOD is correct because it directly returns the complete set of dates from an anchor date (typically the last date in the current visual filter) back across a specified number of intervals, such as -3 MONTH. This single function can be placed inside a CALCULATE filter to sum sales for the trailing three months, with the date range boundary handled automatically. Unlike the other options, it does not require manual date arithmetic (DATESBETWEEN), does not merely shift an existing set (DATEADD), and is not limited to one period (PREVIOUSMONTH).

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

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.