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.
Hi,
Have you followed the DAX formula posted by AlexisOlson to find the solution to your problem?
If so, would you like to mark his reply as a solution so that others can learn from it too?
For more info about the DAX function SelectedValue() in the Power BI, please refer to this link:
https://docs.microsoft.com/en-us/dax/selectedvalue-function
Thanks in advance!
How to Get Your Question Answered Quickly
Best Regards,
Community Support Team _Robert Qin