Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Merging two unrelated tables conditionally

Hi guys,

 

I currently have two tables that haven't got any fields in common, as follows.

 

Product IDProduct
123Item A
234Item B

 

Sales IDProduct Description
45678Description [Item A] Description
56798Description [Item B] Description

 

 

I want to be able to join in the products from table 1 based on the product description on table 2, but not sure how to merge the two tables conditionally based on whether the product description contains the product name. I want to add the product ID and product name to the matched row on the second table.

 

Hope this makes sense?

 

Thanks in advance!

  • Anonymous - Then use FIND, SEARCH or CONTAINSSTRING, maybe like:

     

    Column = 
      VAR __Table = 
        ADDCOLUMNS(
          'Table1',
          "Found",IF(FIND([search],[description],,0)>0,[search],BLANK())
        )
    RETURN
      MAXX(FILTER(__Table,NOT(ISBLANK([Found]))),[Found])

6 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      I cannot rely on fuzzy match, I need to know that the data is matching accurately. There will be a lot of free text in the description column and it will lead to incorrect matches. 

      • Greg_Deckler's avatar
        Greg_Deckler
        Icon for Community Champion rankCommunity Champion

        Anonymous - Then use FIND, SEARCH or CONTAINSSTRING, maybe like:

         

        Column = 
          VAR __Table = 
            ADDCOLUMNS(
              'Table1',
              "Found",IF(FIND([search],[description],,0)>0,[search],BLANK())
            )
        RETURN
          MAXX(FILTER(__Table,NOT(ISBLANK([Found]))),[Found])