Forum Discussion
Power Query inserts unwanted numbers
xchtis That's not an error. It's by design. You simply can't have a structured table with duplicate column names.
What exactly are you doing in PQ that causes the creation of duplicate column names?
Riny_van_Eekelen thanks for taking the time to reply. I'm doing an unpivot with columns that have identical column headers in the original data; I've tried manually deleting all but the first instance of the column name (planning to add them back with autofill down once unpivoted) but instead powerquery automatically adds new column names with numbers (so if I have 'capacity' followed by blanks it adds 'capacity1,' 'capacity2', etc). This is particularly confusing because it doesn't seem consistent--sometimes it leaves all the column name cells blank and lets me autofill them after they're unpivoted. I might try taking a screenshot later to show it.
- Riny_van_EekelenMay 11, 2023Platinum Contributor
xchtis After unpivoting you could extract the first 19 characters from the Attribute column to be left with just "production capacity" down the entire column.
- xchtisMay 12, 2023Copper Contributor
Riny_van_Eekelen I realised that something was wrong with the worksheet as for example it had a row with column headers which I couldn't delete, and keeps refilling with column1/2/3 etc if I try to delete the contents. I think that is also causing unwanted content to appear in the structured table using data from that range. If I try to delete the entire row, the option is greyed out. I tried copying out the data range in other cells into a new blank workbook and it cured most of the issues. I have no idea what cursed that workbook, perhaps a rogue macro, but the problem is solved. Thanks for taking the time to reply