Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Searching for a partial match in a string based on values in a another table

I'm trying to create a new column based on partial text matches in my first column when compared to my reference table.

 

My Locations reference table is set up like:

Locations

CityStateStateAbv
augustageorgiaga
detroitmichiganmi
clevelandohiooh

 

The strings would be:

 

Table1

Words
This is and example string cleveland
A Detroit Example
augusta value here

 

The end result would be:

Table1

 

WordsLocation
This is and example string clevelandCleveland
A Detroit ExampleDetroit
augusta value hereAugusta

 

What would be the best way to achieve this in DAX or M?

 

Thanks!

3 Replies

  • mwegener's avatar
    mwegener
    Icon for Most Valuable Professional rankMost Valuable Professional

    Hi Anonymous ,

     

    I would prefer M.

    Try a fuzzy matching

     

    Regards,

    Marcus

    Dortmund - Germany
    If I answered your question, please mark my post as solution, this will also help others.
    Please give Kudos for support.

    • Anonymous's avatar
      Anonymous
      Not applicable

      This solution works for my original question, but I was hoping I'd be able to take the answer and extrapolate on it and I think fuzzy matching presents issues with state abreviations. In the data there will occasionally be references to state names and abreviations and some states share city names (e.g. Columbus, GA and Columbus, OH). Also, I could see an issue with the state Indiana being abreviated as "in" where the phrase "in" will also be used as a preposition.

       

      Updated Locations Table:

      CityStateStateAbv
      augustageorgiaga
      detroitmichiganmi
      columbusgeorgiaga
      columbusohiooh
      evansvilleindianain

       

      Table1

      Words
      This is an example string for ohio by cleveland
      an example in detroit
      augusta ga value here
      example for cleveland
      evansville in value

       

      Expected end result:

       

      Table1

      WordsCityStateAbv
      This is an example string for ohio by clevelandclevelandoh
      an example in detroitdetroit 
      augusta ga value hereaugustaga
      example for clevelandcleveland 
      evansville in valueevansvillein

       

      Would fuzzy matching be able to pick up on these nuances?