Forum

Power query creatin...
 
Notifications
Clear all

Power query creating duplicate rows after merging. The duplicate rows double each time I refresh the data.

5 Posts
3 Users
0 Reactions
3,724 Views
(@stanley-george)
Posts: 2
New Member
Topic starter
 

Hello All,

I'm getting duplicate rows every time i refresh my data. It doubles every time i hit refresh.

Following are the steps that i followed

1. I created a query from an excel table which was an existing query. 

2. I deleted some columns that i did not need.

3. I pivoted the data based on Sales order# and Price to get a unique list of Sales orders and aggregate price.

4. I loaded it into a new sheet. (Query name = summary)

5. I added 3 columns to the right hand side of the table called "comments", "actions" & "updates".

6. I made a connection of the table which includes the 3 new columns. (Connection name = self ref)

7. I edited "summary" and merged it with "self ref"

8. I expanded the tables to merge the 3 new columns to "summary"

9. I hit save and load.

The final product looked ok, and the comments are dynamic as i expected. However one sales order# which had 2 ship by dates and hence appeared twice in the table started doubling every time i hit refresh. I managed to solve this by editing the query and adding remove duplicates to the end. This stopped the doubling and removed the duplicates. However when i started entering comments and refreshing again a few other rows along with the previus culprot began to double again.

I am a beginner with power query, your inputs will be appreciated. 

 

Thanks

Stan

 
Posted : 12/09/2020 8:56 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Stan,

Please supply your workbook and query, and some source data.

Phil

 
Posted : 13/09/2020 12:09 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Stan,

If a query is returning duplicate data it's because it is referencing itself somewhere along the way. Either the original query is getting all data from the entire workbook, or your new query is. I recommend you check the source for each query to see which one is the culprit. If you get stuck, as Phil said, please supply the workbook containing the query.

Mynda

 
Posted : 13/09/2020 12:40 am
(@stanley-george)
Posts: 2
New Member
Topic starter
 

Thanks Phil and Mynda,

 

Turns out it was a case of duplicate entries causing the problem. I was trying to merge the two tables using the column with the duplicate entry.

I just added an index column after cleaning up the  data and merged the tables using the index column.

It is working fine now on my sample data. Lets hope that it works with the real data at work tomorrow.

Thanks once again for the prompt response.

 

Best regards

 

Stan

 
Posted : 14/09/2020 8:11 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

No worries Stan, glad you figured it out.

Regards

Phil

 
Posted : 14/09/2020 8:30 pm
Share: