Forum Discussion

sbp_axt's avatar
sbp_axt
Regular Visitor
8 years ago
Solved

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 )

 


 

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. 

3 Replies