Forum Discussion

adavid999's avatar
adavid999
Icon for Helper V rankHelper V
6 years ago

Question re merging queries in power query

Hi I have a question re merging queries.

 

I have two tables in power query and want to merge them. T1 has say 5 rows and T2 has 10 rows.

 

I want to add a field from T2 to T1, using a common ID. I merge using Left Outer (all from first, matching from second).

 

However when I join and expand the variable from T2 that I wanted in T1 I generate lots of duplicate rows. I only wanted to populate the original T1 5 rows - and assumed that when I expand this is what would happen.

 

I can get rid of the duplicates but can anyone tell me if I am doing anything wrong?

 

Thanks,

 

A

5 Replies

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

    Hi adavid999 

     

    Can we have a screenshot of both table before the merge and after?

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    LinkedIn

     

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

    Hi adavid999 

     

    If you merging tables you have two choices when expanding default will expand all the matching rows from the second table or you can aggregate where you have to specify sum or count aggr of available column.

     

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    LinkedIn

     

    • adavid999's avatar
      adavid999
      Icon for Helper V rankHelper V

      Thanks for replies and apologies, it was because it is not 1 to 1, there are multiple instances of T1 join field in T2, coffee not kicked in yet!

      A

      • v-xuding-msft's avatar
        v-xuding-msft
        Icon for Community Support rankCommunity Support

        Hi adavid999 ,

         

        Can you share some sample data and your expected output? We will understand more clearly and resolve it quickly.