Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
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.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
8 | |
8 | |
4 | |
3 |