PL-300 Visualize and analyze the data Practice Question
Exhibit
Refer to the exhibit.
```dax
VAR LastDate = MAX('Sales'[OrderDate])
VAR PreviousDate = CALCULATE(MAX('Sales'[OrderDate]), ALLEXCEPT('Sales', 'Sales'[CustomerID]))
RETURN
CALCULATE(SUM('Sales'[Amount]), 'Sales'[OrderDate] = PreviousDate)
```Refer to the exhibit. The DAX measure is intended to return the previous purchase amount for the same customer. However, it returns the current row's amount for most rows. What is the most likely reason?
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
✓
The variable PreviousDate is evaluated within the current filter context, which may be the same as LastDate for single rows
The correct answer is C: the variable PreviousDate is evaluated within the current filter context, which may equal LastDate for single rows. In DAX, a VAR is computed once in the filter context where it is defined; if the row context is not transitioned or the filter context already restricts OrderDate to the current row, then CALCULATE(..., 'Sales'[OrderDate] = PreviousDate) filters on the same date as the current row, returning the current amount instead of the prior purchase. To fix this, the previous date must be computed in a context that ignores the current OrderDate filter, e.g., using CALCULATE with ALL or REMOVEFILTERS on 'Sales'[OrderDate] before assigning the variable. Option A is wrong because a text OrderDate would typically cause type or sort errors, not a consistent return of the current row's amount. Option B is wrong because ALLEXCEPT removing filters except CustomerID would actually help find prior dates, not prevent it. Option D is wrong because CALCULATE does support boolean filter syntax like 'Sales'[OrderDate] = PreviousDate.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The data type of OrderDate is text, causing comparison issues
Why it's wrong here
The suggestion that OrderDate is text is a red herring; nothing in the exhibit indicates a data type mismatch, and if OrderDate were text the comparison would use string ordering rather than chronological ordering. The real failure lies in how the variable PreviousDate is computed, not in column types. DAX date/time columns are typically stored as datetime, so this option misdiagnoses the root cause.
- ✗
ALLEXCEPT removes all filters except CustomerID, so the measure cannot find the previous date
Why it's wrong here
ALLEXCEPT(Sales, Sales[CustomerID]) is used correctly: it removes all filters from the Sales table except the customer filter, preserving the current customer context. That part of the measure works as intended. The problem is that the variable PreviousDate is defined inside the same filter context, so for a single row the MAX(Sales[OrderDate]) returns the row's own date rather than the prior date, making the comparison to LastDate ineffective.
- ✓
The variable PreviousDate is evaluated within the current filter context, which may be the same as LastDate for single rows
Why this is correct
In DAX, variables are evaluated at the point of definition within the current filter context, not at the point of use. When the measure runs for a single row, the filter context includes that row's OrderDate, so CALCULATE(MAX(Sales[OrderDate])) returns that same date—making PreviousDate equal to LastDate. To get the previous date, you need an explicit filter that alters the context, such as FILTER(ALL(Sales[OrderDate]), ...) or a relative time function like DATEADD. This is the classic variable-context pitfall.
- ✗
The CALCULATE function does not support the 'Sales'[OrderDate] = PreviousDate syntax
Why it's wrong here
CALCULATE absolutely supports boolean filter syntax like 'Sales'[OrderDate] = PreviousDate; this is a standard table filter expression. The issue is not syntactic validity but semantic context: PreviousDate is a scalar variable that was evaluated before the CALCULATE transition, so it holds a fixed value—potentially the current row's date—rather than a calculated previous date. Thus the filter expression compares against an incorrect constant, not because the syntax is invalid.
Go deeper
Related to this question
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 →
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.