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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors