Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply

Help with Swith() True() Calculated Column with multiple Criterias

Hello Guys,

 

I am traying to map some values/offerings to specific users using Switch/true with multiple criterias such as:

 

User_name =

SWITCH (
TRUE (),

CONTAINSSTRING ('Offering'[Offering],
"Mobility"
)
|| CONTAINSSTRING ( [Offering], "Security" )
&& NOT CONTAINSSTRING ( [Approver], "L2" )
&& NOT CONTAINSSTRING ( [Region], "WW" )
&& NOT CONTAINSSTRING ( [Region], "Asia" ) && NOT CONTAINSSTRING ( [Region], "ANZ" ), "Mike",

John

 

However, I keep getting values with "WW" in the Region Column for "Mike". Below is a sample of the table.

 

Thanks in advance for the help!

 

Base table could look like this:

ApproverRegionOffering
L2 Deliver_WWAsiaMobility-Site Support
L4 Deliver_WWWWMobility-Site Support
L4 Deliver_WWANZMobility-Site Support
L2 Deliver_WWAmericasSecurity-Site Support
L4 Deliver_WWUKSecurity-Site Support
L4 Deliver_WWNorth CentralSecurity-Site Support
4 ACCEPTED SOLUTIONS
rsbin
Super User
Super User

@Mauri_Castro_70 ,

Please try the following modification:

User_name = SWITCH (
                TRUE (),
               OR( CONTAINSSTRING ('Offering'[Offering], "Mobility"), CONTAINSSTRING ( [Offering], "Security" ))
&& NOT( CONTAINSSTRING ( [Approver], "L2" ))
&& NOT (CONTAINSSTRING ( [Region], "WW" ))
&& NOT (CONTAINSSTRING ( [Region], "Asia" )) && NOT (CONTAINSSTRING ( [Region], "ANZ" )), "Mike",
"John" )

Not sure if this is the final result you are looking for:

rsbin_0-1699304994403.png

Hope this works.

Regards,

 

View solution in original post

OMG!!! It worked perfectly! Thanks so much!!!

 

You Rock!

 

Mauri Castro

View solution in original post

@Mauri_Castro_70 ,

Glad to hear it worked for you.  As for adding a third argument, simply "nest" them as you would an IF statement in Excel.
OR( Condition 3, OR ( Condition 1, Condition 2) ).

Best Regards,

View solution in original post

Excellent!... thanks again for the help!

View solution in original post

5 REPLIES 5

Excellent!... thanks again for the help!

rsbin
Super User
Super User

@Mauri_Castro_70 ,

Please try the following modification:

User_name = SWITCH (
                TRUE (),
               OR( CONTAINSSTRING ('Offering'[Offering], "Mobility"), CONTAINSSTRING ( [Offering], "Security" ))
&& NOT( CONTAINSSTRING ( [Approver], "L2" ))
&& NOT (CONTAINSSTRING ( [Region], "WW" ))
&& NOT (CONTAINSSTRING ( [Region], "Asia" )) && NOT (CONTAINSSTRING ( [Region], "ANZ" )), "Mike",
"John" )

Not sure if this is the final result you are looking for:

rsbin_0-1699304994403.png

Hope this works.

Regards,

 

OMG!!! It worked perfectly! Thanks so much!!!

 

You Rock!

 

Mauri Castro

Sorry, One more quick question. I see that the OR operator only allows for 2 Logical arguments... how can I include a 3rd argument? Should I enter a whole new string for the same User_Name?

 

Thanks again!

Mauricio

@Mauri_Castro_70 ,

Glad to hear it worked for you.  As for adding a third argument, simply "nest" them as you would an IF statement in Excel.
OR( Condition 3, OR ( Condition 1, Condition 2) ).

Best Regards,

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.