Forum Discussion
Multiple nested IF statements
- 1 year ago
Hi tomekm ,
Please try the following DAX for your calculated column and replace 'Table' with the name of your table:Status = IF ( 'Table'[Total] > 0, SWITCH ( TRUE(), 'Table'[A] > 0 && 'Table'[B] > 0 && 'Table'[C] > 1 && 'Table'[D] > 1, IF('Table'[Customer Type] = "OK", "Primary", "Secondary"), 'Table'[A] > 0 && 'Table'[C] > 1 && 'Table'[D] > 0, IF('Table'[Customer Type] = "Upcoming", "Tertiary", "Advanced"), 'Table'[Customer Type] = "Other", "Basic", "Next" ), "No Access" )
The SWITCH() function in DAX acts the same as nested IF() statements. However, it is more performant and easier to manage.If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.
Thanks,Samson
Hi kpost ,
Can you try below DAX:
Status =
IF (
[Total] > 0,
IF (
[A] > 0 && [B] > 0 && [C] > 1 && [D] > 1,
IF ( [Customer Type] = "OK", "Primary", "Secondary" ),
IF (
[A] > 0 && [C] > 1 && [D] > 0,
IF ( [Customer Type] = "Upcoming", "Tertiary", "Advanced" ),
IF ( [Customer Type] = "Other", "Basic", "Next" )
)
),
"No Access"
)
If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks!
Best Regards,
Maruthi