Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Search text for substring as a whole word

Hi everyone,

 

I'd like to create a new column with values "true" or "false" based on whether or not another column contains a keyword I am searching for. But I'd like "true" to be the case only when the keyword appears as a full word and not when it is only part of a word.

 

For example, if the keyword to search for is "IT":

"HEAD OF IT" and "IT WORKER" should both be "true", but "CITY WORKER" should be "false".

 

Can this be done using either Power Query or DAX?

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous 

     

    Split the text and use List.Contains

    List.Contains(Text.Split([Column1]," "),"IT")

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

     

    Split the text and use List.Contains

    List.Contains(Text.Split([Column1]," "),"IT")
    • Anonymous's avatar
      Anonymous
      Not applicable

      Anonymous Thank you very much!