cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cristianml
Post Prodigy
Post Prodigy

If contains a specific group of words for a column then

 

I need to get a way to find a specific group of words for a column cause interferes with other text:

 

Example: I need to get SC for STRATEGY CONSULTING from VAR5 instead of CON that also have the word Consulting in VAR3 : 

cristianml_0-1646097444177.png

As you see the problem is that both have CONSULTING and the CONTAINSTRING considers the VAR3 instead to consider V5

 

SG =
VAR V1 = CONTAINSSTRING('_List SG'[Service Group],"APPLICATION OUTSOURCING")
VAR V2 = CONTAINSSTRING('_List SG'[Service Group],"BUSINESS PROCESS OUTSOURCING")
VAR V3 = CONTAINSSTRING('_List SG'[Service Group],"CONSULTING")
VAR V4 = CONTAINSSTRING('_List SG'[Service Group],"INFRASTRUCTURE OUTSOURCING")
VAR V5 = CONTAINSSTRING('_List SG'[Service Group],"STRATEGY CONSULTING")
VAR V6 = CONTAINSSTRING('_List SG'[Service Group],"SYSTEMS INTEGRATION")

RETURN
IF(V1,"AO",
IF(V2,"BPO",
IF(V3,"CON",
IF(V4,"IO",
IF(V5,"SC",
IF(V6,"SI",
"Other"))))))

 

What other way can I use in this case to get the result for a specific sentence or group of words ?

 

Thanks !

 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @cristianml 

Don't use CONTAINSSTRING, use = e.g.

 

VAR V3 = IF ( '_List SG'[Service Group] = "CONSULTING", True, False)

VAR V5 = IF ( '_List SG'[Service Group] = "STRATEGY CONSULTING", True, False)

 

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

1 REPLY 1
PhilipTreacy
Super User
Super User

Hi @cristianml 

Don't use CONTAINSSTRING, use = e.g.

 

VAR V3 = IF ( '_List SG'[Service Group] = "CONSULTING", True, False)

VAR V5 = IF ( '_List SG'[Service Group] = "STRATEGY CONSULTING", True, False)

 

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors