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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
StephenK2022
Frequent Visitor

Data Duplicating rows after merge

HI,

 

I hope someone can help with this.

 

After I merge 2 queries, some of my data duplicates into new rows in my data table. I am possibly using the wrong type of merge (left outer) but I was hoping someone can help stop this from happeneing. If I use the remove duplicates feature then it will remove some good data as well.

 

StephenK2022_0-1657004632820.png

StephenK2022_0-1657005155599.png

 

 

StephenK2022_1-1657004649751.png

 

1 ACCEPTED SOLUTION

Hello @StephenK2022 ,

 

Thanks for the explanation, I have another question right now, what is the key of the new table because for example let we have the following table

 

stefani_vileva_0-1657014597408.png

 if the key of my tables are columns: colA and colB, when I use the following selection and right click

stefani_vileva_1-1657014647453.png

 

I get the following result, 

 

stefani_vileva_2-1657014679453.png

 

meaning that the key columns of my new tables are colA and colB so as long this combination of values is not reappearing in the dataset, the others will be removed. As you can see the second row with the duplication of 123, x was removed in the second appearing.

I hope this helps a little bit.

 

Kind regards,

Stefani Vileva

View solution in original post

3 REPLIES 3
stefani_vileva
Resolver II
Resolver II

Hello,

 

Can you please explain what is the goal of this merge? 

When you are using left join, then all the rows of the left table are trying to find their match in the second table, so for example if we have the following tables:

Table A

1, xxx, 123

2, yyy, 134

3, zzz, 145

 

Table B

 

123, hello

123, bye

145, goodbye

 

Then, when you try to make a left join of A with B,  using the last col of A and the first of B as a matching key, the result is the following

1, xxx, 123, hello

1, xxx, 123, bye

2, yyy, 134, null

3, zzz, 145, goodbye

 

In order to remove the duplicates, I think it is best to select the key columns of your result table and then to remove douplicates as a group directly through the power query.

If you have any questions, please let me know.

 

Kind regards,

Stefani

Hi Stefani,

 

Thanks for your reply.

 

The goal of the merge is to combine two data sets so that the "Number up.No up" column matches the "Job code" column.

 

The number up column is held in a different file and I want to match it to job code so that I can use it for a calculation. 

 

The problem with removing duplicates through power query is that some rows have similar data. 

 

There might be 2 separate entries that have the same values but at different times.

StephenK2022_0-1657009330291.png

 

Also, some timestamps are the same as well but have different data:

StephenK2022_1-1657009420068.png

 

Hello @StephenK2022 ,

 

Thanks for the explanation, I have another question right now, what is the key of the new table because for example let we have the following table

 

stefani_vileva_0-1657014597408.png

 if the key of my tables are columns: colA and colB, when I use the following selection and right click

stefani_vileva_1-1657014647453.png

 

I get the following result, 

 

stefani_vileva_2-1657014679453.png

 

meaning that the key columns of my new tables are colA and colB so as long this combination of values is not reappearing in the dataset, the others will be removed. As you can see the second row with the duplication of 123, x was removed in the second appearing.

I hope this helps a little bit.

 

Kind regards,

Stefani Vileva

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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