Courseiva
Model the data →easyMultiple Choice

Running Total with DATESYTD: DAX Measure

You have a table with a column 'Date' and a measure 'Total Sales'. You want to calculate the cumulative total of sales over time. 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

✓

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

TOTALYTD(SUM(Sales[Amount]), 'Date'[Date]) is correct because it is a time-intelligence function that evaluates the sum expression over the year-to-date period ending at the latest date in the current filter context, producing a cumulative total over time. It takes the aggregation and a date column as arguments and automatically applies the necessary date filtering. SUM(Sales[Amount]) alone returns only the total for the current context, not a cumulative value. DATESYTD returns a table of dates rather than a scalar cumulative total, and CALCULATE(SUM(Sales[Amount]), ALL(Sales)) removes filters to give a grand total, not a running cumulative 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.

  • ✗

    SUM(Sales[Amount])

    Why it's wrong here

    SUM(Sales[Amount]) is a scalar aggregation that returns the sum of Amount values under the current filter context, such as the single month selected in a report. It does not incorporate any time intelligence logic, so it cannot produce a cumulative figure across months within a year. In a year-to-date scenario, it would simply display the period's total rather than a running total, making it incorrect for the requirement.

  • ✗

    DATESYTD('Date'[Date])

    Why it's wrong here

    DATESYTD('Date'[Date]) returns a table containing all dates from January 1 to the latest date visible in the current filter context, which is useful for filtering but not for producing a scalar measure. Since a measure must return a single value, this function cannot be placed directly in a visual as a metric. It would need to be wrapped in CALCULATE or another aggregation to sum sales, so it fails as a standalone answer.

  • ✗

    CALCULATE(SUM(Sales[Amount]), ALL(Sales))

    Why it's wrong here

    CALCULATE(SUM(Sales[Amount]), ALL(Sales)) removes every filter applied to the Sales table, including any date filters, and consequently returns the grand total of all sales across all time periods. This is not a time-cumulative calculation; it ignores the current date context and locks the result to a fixed overall total. The ALL function is designed for clearing filters to compute ratios or totals, not for performing year-to-date running sums.

  • ✓

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

    Why this is correct

    TOTALYTD(SUM(Sales[Amount]), 'Date'[Date]) is the correct time intelligence function because it evaluates the sum of Amount for dates from the start of the year up to the last date in the current filter context. It respects the Date table's continuous date range and requires a proper relationship between the Date and Sales tables. This yields a cumulative year-to-date total that updates dynamically as the user browses different dates.

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.