Forum Discussion
Multiple Condition IF using switch true
- 4 years ago
Anonymous This looks like a reasonable interpretation for how to handle multiple values. However, the naked P1, P2 column references will probably still cause problems.
This is what my version would look like using this logic:
Migration Status = VAR RB = VALUES ( 'Consolidated Sheet'[RB] ) VAR GTP = VALUES ( 'Consolidated Sheet'[GTP] ) VAR GBS = VALUES ( 'Consolidated Sheet'[GBS] ) VAR ITL = VALUES ( 'Consolidated Sheet'[ITL - EXP non premium - EITL - Non premium - Binder Price Plan] ) VAR EXP_B = VALUES ( 'Consolidated Sheet'[EXP - Binder Price Plan] ) VAR EITL = VALUES ( 'Consolidated Sheet'[EITL - Binder Price Plan] ) VAR P1_Max = SELECTEDVALUE ( 'IRR Retina'[P1 Max - Binder Price Plan] ) VAR P2_Max = SELECTEDVALUE ( 'IRR Retina'[P2 Max - Binder Price Plan] ) RETURN IF ( ISBLANK ( P1_Max ) || ISBLANK ( P2_Max ), BLANK (), SWITCH ( TRUE (), P1_Max = P2_Max, "Retained", P1_Max = EXP_B && P2_Max IN UNION ( EITL, ITL, GTP, GBS ), "Downgrade", P1_Max = EITL && P2_Max IN UNION ( ITL, GTP, GBS ), "Downgrade", P1_Max = ITL && P2_Max IN UNION ( GTP, GBS ), "Downgrade", P1_Max = EXP_B && P2_Max = RB, "Upgrade", P1_Max = EITL && P2_Max IN UNION ( RB, EXP_B ), "Upgrade", P1_Max = ITL && P2_Max IN UNION ( RB, EXP_B, EITL ), "Upgrade", "Cancelled" ) )In this, P1_Max and P2_Max cannot have multiple values but the rest of the variables can.
Do you have exactly one value selected for the relevant variables?
If you're getting all "Retained", then I'm guessing that's because P1_Max and P2_Max are both blank because SELECTEDVALUES is detecting multiple values for them.
No not just one, each variable has multiple values (RB has 4 but ITL has 38 for example) inside of it.
- AlexisOlson4 years agoSuper User
OK. I don't know how the logic is supposed to work if there are multiple values in your case. It definitely gets more complicated since checking equality doesn't really work.