Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

In Power Query, How to add a Column from One Table to Another - if the Tables Share a Common Column?

  • Hi Anonymous 

     

    Download example PBIX file

     

    I knocked together some sample data.  Select the LOTS1 tabe and then click on Merge Queries -> Merge Queries as New.

     

    If you want to just add the column to LOTS1, just select Merge Queries rather than Merge Queries as New.

     

     

     

    Choose LOTS 2 as the 2nd table.  Click on the START_TIME column in both tables to match them.

     

    make sure the Join Kind is Left Outer.  Click OK.

     

     

     

    You'll get a new column with a table in each row.  Click the double headed arrow in the column header to extract the columns in the tables.

     

     

     

     

    Select only the BATCH# column and uncheck the 'Use original column name as prefix'.

     

     

     

     

    Done.

     

     

    Regards

     

    Phil

     

3 Replies

  • Hi Anonymous 

     

    Download example PBIX file

     

    I knocked together some sample data.  Select the LOTS1 tabe and then click on Merge Queries -> Merge Queries as New.

     

    If you want to just add the column to LOTS1, just select Merge Queries rather than Merge Queries as New.

     

     

     

    Choose LOTS 2 as the 2nd table.  Click on the START_TIME column in both tables to match them.

     

    make sure the Join Kind is Left Outer.  Click OK.

     

     

     

    You'll get a new column with a table in each row.  Click the double headed arrow in the column header to extract the columns in the tables.

     

     

     

     

    Select only the BATCH# column and uncheck the 'Use original column name as prefix'.

     

     

     

     

    Done.

     

     

    Regards

     

    Phil

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      .

  • Hi Anonymous 

     

    Yes you can Merge the queries (tables) using a Left Join matched on the START_TIME column.

     

    Without your data I can't give you the code to do it though.

     

    Regards

     

    Phil