Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
The logic I am attempting to follow is:
If column 1 equals True then "Some Designation 1"
If column 2 equals True then "Some Designation 2"
If Column 3 equals "Some Value1" AND Column 4 equals 1 or 2 or 3 or 4 or 5 Then "Some Designation 3"
If Column 3 equals "Some Value2" AND Column 4 equals 1 or 2 or 3 or 4 or 5 Then "Some Designation 3"
Else "Undefined"
I cannot seem to get my SWITCH Correct:
Designation = SWITCH(
TRUE(),
'Table'[column1] = True, "Some Designation 1",
'Table1'[Column2 = True, "Some Designation 2",
'Table1'[column3] = "Some Value 1"
&& 'Table1'[Column 4] = "1"||
'Table1'[Column 4] = "2" ||
'Table1'[Column 4] = "3" ||
'Table1'[Column 4] = "4" ||
'Table1'[Column 4] = "5" ||
'Table1'[Column 4] = "6" ||
'Table1'[Column 4] = "7" ||
'Table1'[Column 4] = "8",
"Some Designation 3",
'Table1'[column3] = "Some Value 2"
&& 'Table1'[Column 4] = "1"||
'Table1'[Column 4] = "2" ||
'Table1'[Column 4] = "3" ||
'Table1'[Column 4] = "4" ||
'Table1'[Column 4] = "5" ||
'Table1'[Column 4] = "6" ||
'Table1'[Column 4] = "7" ||
'Table1'[Column 4] = "8",
"Some Designation 3",
"Undefined")
In the code below, the bolded part is operating incorrectly:
Designation = SWITCH(
TRUE(),
'Table'[column1] = True, "Some Designation 1",
'Table1'[Column2 = True, "Some Designation 2",
'Table1'[column3] = "Some Value 1"
&& 'Table1'[Column 4] = "0050y00000BqlMYAAZ"||
'Table1'[Column 4] = "0051A00000DDSCrQAP" ||
'Table1'[Column 4] = "00580000003E3aSAAS" ||
'Table1'[Column 4] = "005C0000003FsM6IAK" ||
'Table1'[Column 4] = "005C0000003FsMKIA0" ||
'Table1'[Column 4] = "005C0000003FsMRIA0" ||
'Table1'[Column 4] = "005C0000005zJ0DIAU" ||
'Table1'[Column 4] = "005C00000062BkNIAU", "Some Designation 3"
"Undefined")Instead of checking both conditions: IF column 3 equals contains "this value" AND IF column 4 contains "one of these 8 values" then it should be labeled "Some designation 3"
It is checking if either of them are true.
if(x=1 AND (y = 1 OR 2 OR 3 etc...)) then z
Additionally, you can use IN
'Table1'[column3] = "Some Value 1"
&& 'Table1'[Column 4] in { "0050y00000BqlMYAAZ",
"0051A00000DDSCrQAP" ,
"00580000003E3aSAAS" ,
"005C0000003FsM6IAK" ,
"005C0000003FsMKIA0" ,
"005C0000003FsMRIA0" ,
"005C0000005zJ0DIAU" ,
"005C00000062BkNIAU" }
Love hearing about Power BI tips, jobs and news?
I love to share about these - connect with me!
Stay up to date on
Read my blogs on
Remember to spread knowledge in the community when you can!
Did I answer your question? Mark my post as a solution! Proud to be a Super User!
Connect with me!
Stay up to date on
Read my blogs on
As I said: you have to use parentheses. && and || have the same precedence, so A && B || C is calculated as (A && B) || C, not as A && (B || C).
Best
D.
Unfortunately I do not understand what you mean by "Use Parentheses." When I introduce parentheses into my code as if it is an order of operations defining statement the code errors out.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 6 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 14 | |
| 8 | |
| 8 | |
| 8 |