Running Total with DATESYTD: DAX Measure
A company has a fact table 'Sales' with a column 'SalesAmount' and a dimension table 'Date'. They want to create a measure that calculates the running total of sales over time. The Date table is marked as a date table. Which DAX expression is correct?
Quick Answer
The correct DAX expression is Running Total = CALCULATE(SUM(Sales[SalesAmount]), DATESYTD(Date[Date])). This works because DATESYTD is a time intelligence function that returns a contiguous set of dates from the start of the year up through the last date visible in the current filter context, and when wrapped inside CALCULATE, it modifies the filter context to compute a running total year-to-date. On the Microsoft Power BI Data Analyst PL-300 exam, this question tests your understanding of how time intelligence functions rely on a properly marked date table—a common trap is forgetting that DATESYTD requires a continuous date column from a designated date table, not a random date field. The key distinction here is that DATESYTD automatically handles the year boundary, unlike TOTALYTD which is a simpler wrapper; the exam often uses this to see if you know the underlying CALCULATE pattern. Memory tip: think of DATESYTD as “dates from the start of the year to today’s context”—it’s the engine behind any running total that resets annually.
⚠ Common exam trap
Candidates often confuse DATESYTD with a general running total function, but DATESYTD only works within a single year, so the question's wording 'running total over time' might mislead test-takers into thinking any time intelligence function will work, when in fact a proper running total requires a FILTER with ALL or ALLSELECTED.
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
✓
Running Total = CALCULATE(SUM(Sales[SalesAmount]), DATESYTD(Date[Date]))
DATESYTD returns a set of dates from the start of the year to the latest date in the current filter context, and when wrapped in CALCULATE, it correctly computes a year-to-date running total. Since the Date table is marked as a date table, DATESYTD works seamlessly with the time intelligence functions in DAX.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Running Total = CALCULATE(SUM(Sales[SalesAmount]), FILTER(ALL(Date), Date[Date] <= EARLIER(Date[Date])))
Why it's wrong here
EARLIER is used in calculated columns, not measures. In a measure, there is no row context to reference.
- ✓
Running Total = CALCULATE(SUM(Sales[SalesAmount]), DATESYTD(Date[Date]))
Why this is correct
DATESYTD returns a set of dates from the start of the year to the current context date, which creates a running total within the year. For a full running total across years, one would use DATESBETWEEN or a filter.
- ✗
Running Total = TOTALYTD(SUM(Sales[SalesAmount]), Date[Date])
Why it's wrong here
TOTALYTD is a function that calculates year-to-date, but it is used incorrectly; the correct syntax is TOTALYTD(expression, date, filter). However, this also works but is not the simplest. The issue is that it does not handle multiple years; it only shows YTD for each year.
- ✗
Running Total = SUMX(Sales, Sales[SalesAmount])
Why it's wrong here
This simply sums all sales; it does not restrict to dates up to current context. It will return total sales regardless of filter.
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 →
Same concept, more angles
1 more way this is tested on PL-300
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. 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?
easy- A.SUM(Sales[Amount])
- B.DATESYTD('Date'[Date])
- C.CALCULATE(SUM(Sales[Amount]), ALL(Sales))
- ✓ D.TOTALYTD(SUM(Sales[Amount]), 'Date'[Date])
Why D: TOTALYTD calculates the year-to-date cumulative total of an expression. It takes a sum expression and a date column, and computes the cumulative total from the start of the year to the current context. Option A is wrong because SUM simply adds all values without any cumulative or time-based logic. Option B is wrong because DATESYTD returns a set of date ranges, not a cumulative value. Option C is wrong because CALCULATE with ALL(Sales) removes all filters, producing the total over the entire table, not a cumulative total over time.
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.