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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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