Forum Discussion
If text contains value from list then return that value
- 6 years ago
Actually, there is a mor elegant way for it:
let Source = #"Table 2", #"Added Custom" = Table.AddColumn(Source, "AllWords", each Text.Split([Message], " ")), #"Added Custom1" = Table.AddColumn(#"Added Custom", "KeywordFound", each List.First( List.Intersect( { [AllWords], #"Table 1"[Keyword] } ) )), #"Added Custom2" = Table.AddColumn(#"Added Custom1", "ContainsKeyword", each [KeywordFound] <> null) in #"Added Custom2"This assumes that you only want to find full word matches. If you're looking for Substring/partial matches, there is another solution for it in the file attached.
Hi MatejZukovic
you can do this with the function List.FindText
Please let me know if you need help implementing this.
- ImkeF6 years ago
Community Champion
Actually, there is a mor elegant way for it:
let Source = #"Table 2", #"Added Custom" = Table.AddColumn(Source, "AllWords", each Text.Split([Message], " ")), #"Added Custom1" = Table.AddColumn(#"Added Custom", "KeywordFound", each List.First( List.Intersect( { [AllWords], #"Table 1"[Keyword] } ) )), #"Added Custom2" = Table.AddColumn(#"Added Custom1", "ContainsKeyword", each [KeywordFound] <> null) in #"Added Custom2"This assumes that you only want to find full word matches. If you're looking for Substring/partial matches, there is another solution for it in the file attached.
- MatejZukovic6 years ago
Resolver I
Works perfectly. Thanks!
- vlewkeeb5 years agoFrequent Visitor
How would you approach looking up phrases rather than just single words? I just tried this and it works perfectly on single words but not on phrases. In the case of the example above, how would look up "sunny day" as well as "day"?
- FilipKoc4 years agoNew Member
Fantastic and indeed elegant. Thanks