Courseiva
Model the data →mediumMultiple Choice

PL-300 Model the data Practice Question

You are a data analyst for a retail company. You have a Power BI semantic model that includes a fact table named Sales with columns: Date, ProductID, StoreID, Quantity, and Amount. You also have dimension tables: Product, Store, and Date. The Date table is marked as a date table. You need to create a measure that calculates the running total of sales amount over the last 12 months, including the current month. The measure should be dynamic based on the filter context. Which DAX expression 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

✓

CALCULATE(SUM(Sales[Amount]), DATESINPERIOD(Date[Date], MAX(Date[Date]), -12, MONTH))

DATESINPERIOD(Date[Date], MAX(Date[Date]), -12, MONTH) returns a rolling 12-month window ending at the last date in the current filter context, and wrapping it in CALCULATE makes the running total dynamic as slicers or visuals change. This matches the requirement to include the current month and the preceding 11 months. Option A uses hard-coded dates from 2024-01-01, so it is not dynamic and may not cover the last 12 months. Option B uses PARALLELPERIOD, which shifts the entire period back 12 months rather than accumulating a rolling 12-month total. Option D uses TOTALYTD, which calculates a year-to-date total from the start of the fiscal or calendar year, not a rolling 12-month total.

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], DATE(2024,1,1), MAX(Date[Date])))

    Why it's wrong here

    DATESBETWEEN is not appropriate here because its start date is hardcoded as January 1, 2024 rather than being derived from the current filter context. The expression would always begin the sum at that fixed calendar date, regardless of the latest transaction date in the selected period, so it would produce a year-to-date total for calendar 2024, not a true rolling 12-month window. Moreover, if the MAX(Date[Date]) falls before 2024, the result becomes blank, breaking the measure's expected dynamic behavior.

  • ✗

    CALCULATE(SUM(Sales[Amount]), PARALLELPERIOD(Date[Date], -12, MONTH))

    Why it's wrong here

    PARALLELPERIOD shifts the entire current time period back by 12 months but returns only the corresponding prior-year period, not a continuous 12-month range ending at the current maximum date. For example, if the current filter context is a single month, PARALLELPERIOD returns that same single month one year earlier, so the SUM would include only one month's sales rather than the cumulative 12-month total. It does not iterate or expand the date range to cover the trailing twelve months, which is why it fails the rolling 12-month requirement.

  • ✓

    CALCULATE(SUM(Sales[Amount]), DATESINPERIOD(Date[Date], MAX(Date[Date]), -12, MONTH))

    Why this is correct

    DATESINPERIOD correctly constructs a contiguous range of dates ending at MAX(Date[Date]) and extending backward 12 months using the MONTH interval. This creates a filter context containing approximately 365 days that includes the current month and the preceding 11 months, so the CALCULATE SUM aggregates all sales attributable to that trailing twelve-month window. Because the end date is dynamically determined by the active filter context and the interval is relative, the measure automatically updates as the user selects different time periods, making it the accurate rolling 12-month total.

  • ✗

    TOTALYTD(SUM(Sales[Amount]), Date[Date])

    Why it's wrong here

    TOTALYTD computes sales from the beginning of the calendar year up to the latest date in the current filter context, which is a fixed year-to-date measure, not a rolling 12-month total. If the user filters to March 2025, TOTALYTD would sum only January through March 2025, whereas a rolling 12-month measure would sum April 2024 through March 2025. It completely ignores the 12-month lookback requirement and yields values that are systematically smaller than the desired trailing twelve-month metric.

About these practice questions

This PL-300 question is part of Courseiva's 524-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 →

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.