Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Syndicate_Admin
Administrator
Administrator

Removing Duplicates from Merged Tables in Power Query

I am doing a reconciliation from two different data set to find variances but when I do a full outer join between the tables I get duplicates if one of the tables are more than one row for the merge fields. There no unique identifier so I'm merging them using Resource, Date and hours

 

Table A   
ResourceInvoice IDDateHours
John Doe123458/28/202340
Table B   
ResourceInvoice IDDateHours
John Doe456788/28/202340
John Doe987658/28/2023-40
John Doe765438/28/202340

 

Here's what I'm getting: 

Table A Resource

Table A

Invoice ID

Table A DateTable A Hours

Table B

Resource

Table B Invoice IDTable B DateTable B Hours
John Doe123458/28/202340John Doe456788/28/202340
John Doe123458/28/202340John Doe987658/28/2023-40
John Doe123458/28/202340John Doe765438/28/202340

 

Here's what I want to see:

Table A ResourceTable A Invoice IDTable A DateTable A HoursTable B ResourceTable B Invoice IDTable B DateTable B Hours
John Doe123458/28/202340John Doe456788/28/202340
   40John Doe987658/28/2023-40
   40John Doe765438/28/202340

 

Can someone help me, please?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Syndicate_Admin ,

 

Please try:

1. Add an index column to both tables;

vcgaomsft_0-1687831945096.png

2.  Merge Queries --> Merge Queries as New --> Select Table A as the first table and Table B as the second table --> Select the Resource, Date, Hours, and Index columns in both tables --> Choose the Full Outer join type and click OK

vcgaomsft_1-1687831983124.png

3. Expand the new merged column to include the desired columns from Table B.

4. Rename the columns as needed.

 

Result:

vcgaomsft_2-1687832132438.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

This only works for the first record. If there's a same information for another resource, then I'm getting all records from Table A and Table B without any match. For example: If my table are:

Table A    
ResourceInvoice IDDateHoursIndex
John Doe123458/28/2023400
John Doe2222210/10/2023321

 

 

Table B    
ResourceInvoice IDDateHoursIndex
John Doe456788/28/2023400
John Doe987658/28/2023-401
John Doe765438/28/2023402
John Doe3333310/10/2023323
John Doe4444410/10/2023-324
John Doe5555510/10/2023325

 

I'm getting:

ResourceTableA.Invoice IDTableA.DateTableA.HoursTableB.Invoice IDTableB.DateTableB.Hours
John Doe123458/28/202340456788/28/202340
nullnullnullnull987658/28/2023-40
nullnullnullnull765438/28/202340
nullnullnullnull3333310/10/202332
nullnullnullnull4444410/10/2023-32
nullnullnullnull5555510/10/202332
John Doe2222210/10/202332nullnullnull

 

What I want to get is:

ResourceTableA.Invoice IDTableA.DateTableA.HoursTableB.Invoice IDTableB.DateTableB.Hours
John Doe123458/28/202340456788/28/202340
nullnullnullnull987658/28/2023-40
nullnullnullnull765438/28/202340
John Doe2222210/10/2023323333310/10/202332
nullnullnullnull4444410/10/2023-32
nullnullnullnull5555510/10/202332
Syndicate_Admin
Administrator
Administrator

If a data is only in Table B, I would want the merged record in Table A to show null. How can I compare a null value to previous row only for data that are in both tables?

Anonymous
Not applicable

Hi @Syndicate_Admin ,

 

Please try:

1. Add an index column to both tables;

vcgaomsft_0-1687831945096.png

2.  Merge Queries --> Merge Queries as New --> Select Table A as the first table and Table B as the second table --> Select the Resource, Date, Hours, and Index columns in both tables --> Choose the Full Outer join type and click OK

vcgaomsft_1-1687831983124.png

3. Expand the new merged column to include the desired columns from Table B.

4. Rename the columns as needed.

 

Result:

vcgaomsft_2-1687832132438.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Martin_D
Super User
Super User

You cannot produce the result you want from a single merge step. If your requirements demand these empty cells then you need to clean up them afterwards. E.g., you could compare the first 3 columns with the previous row as described here, check whether a Table A row is a duplicate of the previous row, and add custom columns in your first-and-blank-rows format. Then finally remove the columns from table A from the merge result that you don't want to have.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors