How to Fix Duplicate Rows After Power Query Merge
Question details
The user is experiencing duplicate rows or repeated fields when performing a merge in Power Query using a key column.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Joining two data queries using a shared merge key column.
- Observed behavior
- The resulting merged query unexpectedly generates duplicated states, duplicate rows, or repeated column fields.
Before troubleshooting, identify the exact key columns (e.g., State ID) used to merge the two tables and determine which query serves as the primary table versus the lookup table.
Remove or Aggregate Duplicate Keys Before Merging
Ensure the merge key in your secondary (lookup) query is completely unique to prevent a Cartesian product effect that multiplies rows.
When performing a Left Outer Join, Power Query retrieves all rows from the first table and matching rows from the second. If the second table has multiple rows with the same key, it will create duplicate rows in the final output.
Open the Power Query Editor and select your secondary query (e.g., the Harvested query) from the Queries pane on the left.
Click on the header of the key column (such as State ID) that you are using to match the tables.
Navigate to the 'Home' tab, click 'Remove Rows' in the ribbon, and select 'Remove Duplicates' to keep only unique keys.
If you need to keep data from the duplicate rows, go to the 'Transform' tab and click 'Group By' to aggregate the records (e.g., Sum or Average) into a single row per key.

Standardize Data Types and Clean Formatting
Mismatched data types or hidden spaces in the key columns can cause the merge to fail or behave inconsistently.
Expand Merged Tables Carefully to Avoid Repeated Fields
Prevent repeated data fields by selecting only the necessary columns when expanding the new merged table column.
Try WPS Office for Your Data Analysis Needs
If you frequently struggle with complex Excel add-ins and tools like Power Query, consider switching to WPS Office. It provides a lightweight, highly compatible alternative with intuitive data processing tools, seamless format support, and a user-friendly interface.
- 1. Download the installer: Visit the official WPS website and download the free WPS Office installer.
- 2. Install the software: Run the installer and follow the quick on-screen instructions to complete the setup.
- 3. Open your Excel files: Launch WPS Spreadsheet and open your existing .xlsx files natively without losing any data formatting.

Frequently Asked Questions
Why does a Left Outer Join in Power Query create duplicate rows?
A Left Outer Join retrieves all rows from the first table and matching rows from the second. If the second table has multiple rows with the same merge key, Power Query will duplicate the row from the first table for every match it finds in the second table.
How can I find duplicates in my merge key column before joining?
In the Power Query Editor, select your key column, go to the 'Home' tab, click 'Keep Rows', and select 'Keep Duplicates'. This will filter the table to show only the duplicate values so you can investigate them before merging.
Does 'Remove Duplicates' in Power Query keep the first or last row?
Power Query's 'Remove Duplicates' feature keeps the first occurrence of the duplicate values based on the current sort order of the table, and it discards all subsequent matches.
Why are my column names showing prefixes like 'Table1.State ID' after merging?
This happens because the 'Use original column name as prefix' option was checked when you expanded the merged table column. You can fix this by deleting the expanded step in the 'Applied Steps' pane and re-expanding with that option unchecked.




