How to nest IF statements effectively in Power BI

Hi,

Most languages allow multiple conditions in an IF statement… except for DAX. You have to nest your IF statements in DAX. It becomes a little bit messy when the number of conditions increases.

With this in mind, I just want to know why DAX cannot perform “if then else”? Would they be including this function in the future? Or is there any easier or simpler way I could perform this in DAX? I hope someone can shed some light on this.

Thanks in advance!

Hi,

You can use if then else in the query editor in M language in a custom column.

For a DAX measure have a look at https://forum.enterprisedna.co/t/switch-true-logic-explained/216 explaining the SWITCH formula.

Hope this helps.

Paul

Enterprise%20DNA%20Expert%20-%20Small

SWITCH/TRUE logic is the answer here

You could try using this:

Measure = 
Switch ( True(), 
 condition1,"Result1"  , 
    condition1,"Result1"  , 
etc...                     ) 

See here for an explanation