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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
atavo
Helper I
Helper I

SEARCH TEXT STRING BASED ON LIST OF VALUES - EXACT MATCH

Hi

 

There have been solutions offered regarding searching string text using a list of values, eg:

 

1. https://community.powerbi.com/t5/Desktop/Power-query-Add-column-with-list-of-keywords-found-in-text/...

2. https://community.powerbi.com/t5/Desktop/joinAlgorithm-and-keyEqualityComparers/m-p/182148#M79842

 

...but these do not address the following challenge

PROBLEM

Text: "I LOVE MOTORBIKES".

 

List of Values: BIKES, BIKE, MOTOR, MOTORBIKE, MOTORBIKES

 

CHALLENGE: When I perform the comparison, ONLY "MOTORBIKES" should return TRUE.

 

Is there a way of doing this in Power Query

 

Thanks in advance

Alfred

1 ACCEPTED SOLUTION
atavo
Helper I
Helper I

Thanks
Was able to solve the problem by wrapping the string text in single spaces (b4 and after). Did the same with the list of lookup values. Thereafter, comparison worked like a gem.
Alfred

View solution in original post

4 REPLIES 4
giftchima
Frequent Visitor

Can you please show me how to do this? I am stuck. Thank you.

@atavo 

atavo
Helper I
Helper I

Thanks
Was able to solve the problem by wrapping the string text in single spaces (b4 and after). Did the same with the list of lookup values. Thereafter, comparison worked like a gem.
Alfred
Stachu
Community Champion
Community Champion

you convert the text to list and then use list comparators, e.g. List.Contains
https://docs.microsoft.com/en-us/powerquery-m/list-contains



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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