Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

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

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity 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.

    • Anonymous's avatar
      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.