Forum Discussion

datanau001's avatar
datanau001
Helper III
6 years ago
Solved

Power Query - Match text from distinct tables

Hello all,   I’m working with two tables “A” and “B”, where in table “A” the main information is a code of 5 digits and in “B” the main information are texts ( problem description and comments rela...
  • mahoneypat's avatar
    6 years ago

    You can use an approach like this to get the codes for descriptions that include a given code from TableA.  This assume you use this measure in a Table visual that has the Code column from TableA.  If more than one row in TableB contains that code, it will concatenate the codes together.

     

    Table B Number(s) =
    VAR tableAcode =
        SELECTEDVALUE ( TableA[Code] )
    VAR matchingBrows =
        FILTER ( TableB, SEARCH ( tableAcode, TableB[Comments],, 0 ) > 0 )
    RETURN
        IF (
            ISBLANK ( COUNTROWS ( matchingBrows ) ),
            BLANK (),
            CONCATENATEX ( matchingBrows, TableB[Code], "; " )
        )

     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat