Forum Discussion
Anonymous
4 years agoNot applicable
Multiple IFs & Ands
Hi Everyone I am trying to create a conditional column that checks a number of criteria and, depending on the answer to those queries, gives a result. To give some info, I have a table contai...
- Anonymous4 years ago
Hi Anonymous ,
You could use " in {1,2,3,4} " instead of using multiple equals.
For example:column = IF( ([columnA] in {1,2,3,4}&&[columnB] in {"x","y"}) || ([columnA] not in {1,2,3,4}&&[columnB] not in {"x","y"}), "OK", if( ([columnA] in {1,2,3,4}&&[columnB] not in {"x","y"}) || ([columnA] not in {1,2,3,4}&&[columnB] in {"x","y"}), "check") )Or you could use switch() function.
Switch(true(), conditon, value, conditon, value)
Best Regards,Jay
Pragati11
4 years agoSuper User
Hi Anonymous ,
Can you share what logic you have used in Power BI which is not working?
Thanks,
Pragati
- Anonymous4 years agoNot applicable
Hi Pragati11
I've tried a few but to give you an idea, I have tried:
- =IF( [column A] = "1" && [column B] ="X" || [column A] ="1" && [column B] = "Y" || [column A] = "2" && [column B] = "X" || [column A] = "2" && [column B] = "Y" and so on until all the needed statements have been entered...
- =IF([column A] = "1" || [column A] = "2" || [column A] = "3" || [column A] = "4" && [column B] = "X" || [column B] = "Y" etc...
I don't know if it helps but, values 1, 2, 3 and 4 are a variation of the same value. so 1 is "1-a", 2 is "1-b", 3 is "1-c", 3 is "1-d". Values "X" and "Y" are actual X is blank and Y is "NONE"