Forum Discussion
Mk60
2 years agoResolver I
How to replace nested IF calculation for New Column with using switch
This nested if calculation DOES work fine, but I have hard time replacing this using SWITC function? I amm affraid that if I have much longer nested calc it might be safer to use switch instead. Can ...
- 2 years ago
I believe this would be better done in Power Query using conditional columns. To answer your question, you could use switch/true
=SWITCH(TRUE(),
Query1[PRODUCT]="20","Prod1",
Query1[PRODUCT]="CC-20b","Prod2",
etc
also, use daxformatter.com to make it easier to read.
akoren2
2 years agoAdvocate I
Product = SWITCH(
TRUE(),
Query1[PRODUCT] IN {"20"} , "Prod1",
....
Query1[PRODUCT] IN {"31","43","50","53","54","96","98"},"Prod4",
.....
Else statement if needed
)