Forum Discussion

powerbiexpert22's avatar
powerbiexpert22
Icon for Impactful Individual rankImpactful Individual
49 minutes ago

Switch Function

I have created below DAX measure using SWITCH() to return an amount based on the currency selected by the user:

AmountCurr = VAR SelectedCurrency = SELECTEDVALUE(Table[Currency]) RETURN SWITCH( SelectedCurrency, "USD", [AmountUSD], "EUR", [AmountEUR], "SGD", [AmountSGD] )

My question is related with performance:

When a user selects let say USD, does Power BI calculate all three measures ([AmountUSD], [AmountEUR], [AmountSGD]) and then return [AmountUSD]?

Or does SWITCH() calculate only the measure corresponding to the selected currency?

For example, if the user selects USD, will only [AmountUSD] be evaluated?

No RepliesBe the first to reply