The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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:
Approver | Region | Offering |
L2 Deliver_WW | Asia | Mobility-Site Support |
L4 Deliver_WW | WW | Mobility-Site Support |
L4 Deliver_WW | ANZ | Mobility-Site Support |
L2 Deliver_WW | Americas | Security-Site Support |
L4 Deliver_WW | UK | Security-Site Support |
L4 Deliver_WW | North Central | Security-Site Support |
Solved! Go to Solution.
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:
Hope this works.
Regards,
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,
Excellent!... thanks again for the help!
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:
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
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,