Forum Discussion
Using MTD and QTD
- 3 months ago
Hi mp390988
It sounds like the suggested measures are working, which is good news 🙂
To answer your question on the measure you just posted that isn't working:
When multiple filter arguments are provided to CALCULATE, they are evaluated independently (in the existing context) then applied simultaneously when evaluating the expression in the first argument.
mMTDRev = CALCULATE( [Revenue], DATESMTD ( 'CalendarTbl'[Date] ), -- Filter 1: MTD in current context CalendarTbl[Date] <= TODAY() -- Filter 2: Dates <= Current date )For example, if CalendarTbl is unfiltered, and assuming the maximum values of CalendarTbl[Date] is 31 December 2026 and the current date is 6 May 2026, the two filters would be:
- MTD as at 2026-12-31 = All of December 2026
- All dates up to and including 6 May 2026
These two filters have no intersection, so the [Revenue] measure is blank when both are applied simultaneously.
The difference with the measures I suggested is that they first apply the "today" filter (as an outer filter), then apply the MTD filter (as an inner filter).
Recommended article:
https://www.sqlbi.com/articles/order-of-evaluation-in-calculate-parameters/
Hi,
That measure returns a blank. I cannot spot a mistake in your measure though. Looks like some data type issue. Please share the download link of the PBI file.