Forum Discussion
xchtis
May 10, 2023Copper Contributor
Power Query inserts unwanted numbers
Hello everyone,
I tried searching on the net and couldn't find answers. When I create a table from a Powerquery it automatically adds numbers to column headings where they are identical (so if lots of columns are called 'production capacity' they will be named 'production capacity1', 'production capacity2', etc). This makes it impossible to summarise by pivot table. What causes this error?
Thanks, S.
- Riny_van_EekelenPlatinum Contributor
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?
- xchtisCopper Contributor
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_EekelenPlatinum 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.