Forum Discussion

manoj619's avatar
manoj619
Regular Visitor
3 years ago

need to match data from a different table that includes the text of the current table column

I have a sysid and a status column in table 1, and I need to search for and retrieve data from table 2's sysid column that includes the text from table 1's sysid column

Expecting output

 

8 Replies

  • Try the following :

    FILTER(
    Table2,
    SEARCH(
    MAX(Table1[sysid]),
    Table2[sysid],
    ,
    0
    ) > 0
    )

     

    The MAX function will get the maximum value of the sysid column in Table1, assuming that each sysid appears only once in Table1. 

    The SEARCH function will search for the sysid text in the sysid column of Table2. If the sysid text is found, the function returns value different from 0, which is used to filter Table2 using the FILTER function.

     

    Be careful with the SEARCH function since it is case-sensitive, so if you want to perform a case-insensitive search, using FIND can be an alternative.

    • manoj619's avatar
      manoj619
      Regular Visitor

      Thanks for the reply,

      but, i am getting error like this when I tried

       

      • AmiraBedh's avatar
        AmiraBedh
        Icon for Super User rankSuper User

        I tried to reproduce what you provided in the screenshot. You need to create a calculated table like below : 

        Table 2 = FILTER('Second Table', CONTAINS('First Table', 'First Table'[sysid], 'Second Table'[sysid]))

         

        I am attaching the PBI file.

  • 1. In the power query, split the first column.

    2. Create two duplicates of the table.
    3. Delete the first splitted column in the first table and delete the second splitted column in the second table.
    4. Append as a new quesry , the duplicates of the table by renaming as same column name.
    5. Delete the duplicates.
    6. Make the new relaationship between the appended table and the table2.
    7. filter the blank values in the id.