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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
sbp_axt
Regular Visitor

Text.contains search value from a second table

Hi - I am trying to add a custom column which search each row in a column for multiple substrings which are contained in a second table. Ie if the substring "red" is contained in "XredX', then populate a new column with "color"

 

Currently I have to add each value to search for manually, eg

= Table.AddColumn(#"Table", "Result", each if Text.Contains([TextToSearch], "red", Comparer.OrdinalIgnoreCase) then "color"

else if Text.Contains([TextToSearch], "blue", Comparer.OrdinalIgnoreCase) then "color"

else null )

 


Capture.PNG

 

but I'm hoping there's a way to add  reference to a dynamic List which isn't in the same table and have the Text.Contains function loop through these. 

eg

= Table.AddColumn(#"Table", "Result", each if Text.Contains([TextToSearch], [LookupList], Comparer.OrdinalIgnoreCase) then [LookupResult]

else null )

 

Any help is much appreciated. 

1 ACCEPTED SOLUTION
ImkeF
Community Champion
Community Champion
3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@sbp_axt,

 

You may also try SEARCH Function in DAX.

https://community.powerbi.com/t5/Desktop/quot-IF-Contains-Text-quot-function-on-a-table-querying-a-L...

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ImkeF
Community Champion
Community Champion

Thanks ImkeF, this is exactly what I was after. 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 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.

Top Solution Authors