In a calculation group, to switch context to month-to-date (MTD), which DAX expression is correct for the calculation item?

Prepare for the Fabric Analytics Engineer Associate Test with comprehensive materials. Explore flashcards, multiple choice questions, and detailed explanations. Get ready for your success!

Multiple Choice

In a calculation group, to switch context to month-to-date (MTD), which DAX expression is correct for the calculation item?

Explanation:
Switching the evaluation context to a specific time window is done by recalculating the selected measure within a modified filter context. In a calculation item, you want the current measure (the one chosen by the user in the group) to be evaluated as if the date filter is limited to month-to-date. The way to achieve this is to wrap the selected measure with CALCULATE and apply the time-intelligence function that defines the window, like DATESMTD('Date'[Date]). This pattern—CALCULATE( SELECTEDMEASURE(), DATESMTD('Date'[Date]) )—ensures the measure runs in the MTD context while preserving other filters and the selected measure. The other options don’t correctly apply a date-context change to the current measure: GENERATE would expand tables rather than modify filter context, MEASURE isn’t a valid way to apply a time context in this scenario, and combining COMBINEVALUES in CALCULATE doesn’t produce the proper scalar measure result for an MTD calculation.

Switching the evaluation context to a specific time window is done by recalculating the selected measure within a modified filter context. In a calculation item, you want the current measure (the one chosen by the user in the group) to be evaluated as if the date filter is limited to month-to-date. The way to achieve this is to wrap the selected measure with CALCULATE and apply the time-intelligence function that defines the window, like DATESMTD('Date'[Date]). This pattern—CALCULATE( SELECTEDMEASURE(), DATESMTD('Date'[Date]) )—ensures the measure runs in the MTD context while preserving other filters and the selected measure. The other options don’t correctly apply a date-context change to the current measure: GENERATE would expand tables rather than modify filter context, MEASURE isn’t a valid way to apply a time context in this scenario, and combining COMBINEVALUES in CALCULATE doesn’t produce the proper scalar measure result for an MTD calculation.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy