Forum Discussion

Merleau's avatar
Merleau
Helper II
5 years ago
Solved

Using different fields from a table to select records from another table in M

Hello,   I need help in using two different attributes from a table to select records from another table.   I have two starting tables.   The main one – table A - looks like: ID Other_c...
  • PC2790's avatar
    5 years ago

    Hello Merleau ,

     

    Another approach of achieving this can be as below:

    1) Merge the two tables "as New" as Inner Join on the basis of ID

    = Table.NestedJoin(TableA, {"ID"}, TableB, {"ID"}, "TableB", JoinKind.Inner)

    2) Again merge the two tables "as New" on the basis of ID in Table A and parent_id in Table B:

    = Table.NestedJoin(TableA, {"ID"}, TableB, {"parent_Id"}, "TableB", JoinKind.Inner)

    3) Then Append the two outcome tables to get the desired result:

    = Table.Combine({Merge1, Merge2})

    The end result would look something like this:

    This is somewhat differnet from the end result shown by you.

    Please recheck your requirement and the result given by you as there seems to be a mismatch.

    If you are looking to get the result from Table A that are presnet in Table B, the records wit ID1 and ID3 should not be part of the reuslt.

     

    Please confirm.

    I hope this might solve your purpose.

     

    Thankyou