Forum Discussion
Power Query - Extract an Existing Column Name and put it in a new Custom Column
- 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.
You must have typed
= [Column A]
That's not what I said to do.
= "Column A"
As for your scenario where you will have to extract the name of a column that you don't know the name of, I refer you to my original question. How is the query supposed to know which column to extract the name of if you can't refer to it by name?
I know its name, it's the first column and its name is "Sunny" as in the example above (for the other reports the name is different).
I just have to fill a new column with that name, but dynamically, not with ="Sunny", as each report has a different column name corresponding to each Brand.
- Anonymous8 years agoNot applicable
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.
- Anonymous8 years agoNot applicable
That still doesn't answer my question. If you can't refer to it by name, how do you know which column to use? Is it literally the first column on the left? Is it always the third? Could it change positions based on which report you're in?
- ViorelCa8 years ago
Helper I
It is always the first column, and after I get its name (the name of the Brand) I will change it with the proper name (P&L Category), therefore in the new Custom Column I have to remain with the name of the Brand.
- ViorelCa8 years ago
Helper I
Many thanks, Anonymous , it works like a charm!
I remain indebted to you!
Kind regards,
Viorel