Forum Discussion
ViorelCa
Helper I
8 years agoPower Query - Extract an Existing Column Name and put it in a new Custom Column
Dear Colleagues, I did not find a solution for a simple problem: Create a new custom column whose only content should be the name of an existing column in that Table. Many thanks! Viorel...
- Anonymous8 years ago
OK in that case your custom column's formula should be
= List.First(Table.ColumnNames(#"Insert Previous Step Here"))
...for whatever the previous step was. I'm going to guess it's #"Renamed Columns" or #"Changed Type" or something like that.
ViorelCa
Helper I
8 years agoI did this and it fills the new clumn with the content of the Column A (which I do not want) and not with the name of Column A (Which is "Column A").
I know this scenario seems stupid, but this is the format of a report that I have to transform :
I have multiple reports whose name of the first column "Column A" is the name of a Brand, so for each brand I have to do a transformation and the only place where I have the name of the Brand is in The name of the Column A, therefore I have to extract it dynamically.
ViorelCa
Helper I
8 years ago| Sunny | Date | Value | New Column | Windy | Date | Value | New Column | |
| sales | 5/5/2012 | 5,000 | Sunny | sales | 5/5/2012 | 6,000 | Windy | |
| cost | 5/7/2012 | 7,000 | Sunny | cost | 5/7/2012 | 9,000 | Windy |