cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
auswtz
Frequent Visitor

How to merge two tables by a column using M power query?

Hi,

 

I've currently got two tables that I'm trying to merge, one is from a data source and the other is a custom table that's been created in Power BI. I've updated the custom table with a new row data  and works fine. Now, I would like to include this new row into my source table by combining the two.

 

I was able to initially merge this using related tables, but after adding in a new row, the related table doesn't seem to pull the updated data from the custom table. From reading articles, it was recommended to do power query instead of dax? I've applied a merge query but this also doesn't seem to work as I still couldn't see the new row/definition from custom table? Any suggestions would be really appreciated... I'm novice in M an I can't seem to work out what it is Im doing wrong?

 

 

Custom Table  
Existing RowData AData
New RowData BData

 

Wanted outcome:

Source Data Table  
Existing RowData AData
New RowData BData
1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @auswtz 

When you merge in Power Query you get to choose the Join Kind (how the tables are merged).  The merge requires a matching column in both tables with values that can be linked together.

The default join in PQ is Left Outer which means it will omit rows in the 2nd table if there isn't a matching value in the 1st table.

In this image, the tables are being joined on the Name column.

join-kind.png

If your new row in the 2nd table doesn't have a corresponding value in Table 1 - like the name DD in the above image, it won't get merged into the new table if you use a Left Outer Join.

left-outer.png

If you are still having trouble with this, please post your tables so I can see what data you are working with.

Regards

Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

3 REPLIES 3
PhilipTreacy
Super User
Super User

@auswtz 

No worries 🙂



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


PhilipTreacy
Super User
Super User

Hi @auswtz 

When you merge in Power Query you get to choose the Join Kind (how the tables are merged).  The merge requires a matching column in both tables with values that can be linked together.

The default join in PQ is Left Outer which means it will omit rows in the 2nd table if there isn't a matching value in the 1st table.

In this image, the tables are being joined on the Name column.

join-kind.png

If your new row in the 2nd table doesn't have a corresponding value in Table 1 - like the name DD in the above image, it won't get merged into the new table if you use a Left Outer Join.

left-outer.png

If you are still having trouble with this, please post your tables so I can see what data you are working with.

Regards

Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hi @PhilipTreacy 

 

Well, I'm just feeling really silly now. I did previously merge using the left outer join but didn't think to double check the formatting of the name. The notorious extra spacing caught me. I've removed this and I'm now able to merge the two tables.

 

Thank you for your help 🙂

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors