Which of the following DAX expressions correctly activates an inactive Date to ShipDateKey relationship for the Shipped measure?

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

Which of the following DAX expressions correctly activates an inactive Date to ShipDateKey relationship for the Shipped measure?

Explanation:
Activating an inactive relationship for a specific calculation is done by wrapping the measure in CALCULATE and using USERELATIONSHIP to specify which relationship to use during evaluation. In this case, you want the Shipped measure to be computed using the ShipDateKey relationship, not the default active one. The expression sums the SalesAmount, but the CALCULATE call includes USERELATIONSHIP('Date'[DateKey], 'Sales'[ShipDateKey]), which tells DAX to treat that DateKey ↔ ShipDateKey link as active just for this calculation. This lets Shipped reflect data by ship date, while the Orders measure can continue to use the existing (likely OrderDateKey) relationship. Note that using RELATED is not appropriate for activating a relationship in a measure; it's for pulling a related column value in a row context, not for controlling evaluation context.

Activating an inactive relationship for a specific calculation is done by wrapping the measure in CALCULATE and using USERELATIONSHIP to specify which relationship to use during evaluation. In this case, you want the Shipped measure to be computed using the ShipDateKey relationship, not the default active one. The expression sums the SalesAmount, but the CALCULATE call includes USERELATIONSHIP('Date'[DateKey], 'Sales'[ShipDateKey]), which tells DAX to treat that DateKey ↔ ShipDateKey link as active just for this calculation. This lets Shipped reflect data by ship date, while the Orders measure can continue to use the existing (likely OrderDateKey) relationship. Note that using RELATED is not appropriate for activating a relationship in a measure; it's for pulling a related column value in a row context, not for controlling evaluation context.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy