Forum Discussion
tomekm
1 year agoHelper III
Multiple nested IF statements
Hello, I'm trying to write a dax formula for a calculated column that contains multiple IF statements but I'm getting stuck with syntax errors. This is how the formula looks like in excel, but it...
- 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
v-karpurapud
1 year agoCommunity Support
Hi tomekm
Could you please confirm if your query have been resolved the solution provided by SamsonTruong , kpost and maruthisp ? If they have, kindly mark the helpful response and accept it as the solution. This will assist other community members in resolving similar issues more efficiently.
Thank you.