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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Finding Values that Contains text no matter which order it is in

Hi, 

 

I hope all is well. I am working on a project for my team. I have a column in my table that contains a certain amount of codes in one string. What I want to do is create a column where if I type in ANY code I will get a list of people who have that code in their column. It seems as if the code I am using is only bringing the first value/code that exists for that person. 

 

Here's my code......custom column....

= if Text.Contains ([descriptor] , "ALUM") then "ALUMS"

else if Text.Contains ([descriptor] , "ALND") then "non"

else if Text.Contains ([descriptor] , "FRND") then "Friend"

else " "

 

This code only brings back those people where the code is the first value in that string. Someone might have codes FRND ALUM, but if I chose ALUMS from the filter this person won't show because ALUM is not the first code. How can i make this work where if I type in a code I want everyone to show who has that code no matter which order it is in?

 

Please help!!!

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

I don't see how you could do this in Power Query if you desire user interaction. I would do this in DAX using CONTAINSSTRING and I wouldn't use a calculated column, I would use a measure.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Can you please show me an example where I can use it using CONTAINSSTRING for a measure?


@Greg_Deckler wrote:

I don't see how you could do this in Power Query if you desire user interaction. I would do this in DAX using CONTAINSSTRING and I wouldn't use a calculated column, I would use a measure.


 

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.