Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am using a Switch True evaluation and am getting all results back in the expected manner, with the exception of one item. I have tried moving the line to a different spot in the evaluation, but then I lose others. Is it possible this is an order of evaluation problem? The red font is what is not getting picked up, even though I know I have expected results in that category.
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
Hi @Anonymous ,
I think for Non Error Spares MGMT'[UX300] is BLANK ().
Try this :
Missed Obligation =
VAR a = 'Spares MGMT'[Line_Released] = "1"
&& 'Spares MGMT'[Error_any] = "0"
&& 'Spares MGMT'[Spares_DM] = "01_SPARES_MISSED_OBLIGATION"
&& 'Spares MGMT'[UX300] = "0"
RETURN
SWITCH (
TRUE (),
'Spares MGMT'[Line_Released] = "1"
&& 'Spares MGMT'[Error_any] = "0"
&& 'Spares MGMT'[Spares_DM] = "01_SPARES_MISSED_OBLIGATION"
&& 'Spares MGMT'[UX300]
= BLANK (), "NonError",
a
&& 'Spares MGMT'[EXPORT] = "0", "Domestic",
a
&& 'Spares MGMT'[EXPORT] = "1", "Export",
a
&& 'Spares MGMT'[UX300] = "1", "UX300",
'Spares MGMT'[Line_Released] = "1"
&& 'Spares MGMT'[Error_any] = "1"
&& 'Spares MGMT'[Spares_DM] = "01_SPARES_MISSED_OBLIGATION", "Error",
"N/A"
)
Regards,
Harsh Nathani
Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!
So, I took the same exact logic and entered it as it's own calculated column and it gave the expected result. I did not change anything in the logic, just put it by itself. So, what's next? If I put it back in with the other statements, it's still not working, even though it is by itself.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
49 | |
26 | |
21 | |
15 | |
12 |
User | Count |
---|---|
57 | |
49 | |
44 | |
19 | |
18 |