Forum Discussion
DAX Switch True
Hi Anonymous,
the statements in SWITCH is evaluated statement by statement. If it encounters a statement which is true, it evaluates the corresponding expression and then quits the evaluation of the remaining statements. In your case, your first statement is
'Spares MGMT'[Line_Released] = "1"
&& 'Spares MGMT'[Error_any] = "0"
&& 'Spares MGMT'[Spares_DM] = "01_SPARES_MISSED_OBLIGATION"
&& 'Spares MGMT'[UX300] = "0"
&& 'Spares MGMT'[EXPORT] = "0", "Domestic",
while the one you say is missing is
'Spares MGMT'[Line_Released]="1"
&& 'Spares MGMT'[Error_any]= "0"
&& 'Spares MGMT'[Spares_DM]="01_SPARES_MISSED_OBLIGATION", "NonError",
If 'Spares MGMT'[Line_Released]="1" && 'Spares MGMT'[Error_any]= "0" && 'Spares MGMT'[Spares_DM] = "01_SPARES_MISSED_OBLIGATION" evaluates to true, as well 'Spares MGMT'[UX300] = "0"
&& 'Spares MGMT'[EXPORT] = "0", evaluates to true, it will never reach the statement you say is missing.
And if you move the "missing statement" to the top of your statements, when this evaluates to true, the rest of the statements will not be evaluated. So you might have to refine you logic a little. Or perhaps split it into two columns
Cheers,
Sturla