Forum Discussion
Referencing a column by position not name as name is variable
- 4 years ago
1. Insert an Index column just before #"Promoted Headers".
2. Issue this statement (This would change your first row to a column name "Source Name"
Table.ReplaceValue(#"Added Index",each [Source.Name],each if [Index] = 0 then "Source Name" else [Source.Name],Replacer.ReplaceValue,{"Source.Name"})3. Now delete the Index column
4. After this you can promote headers.
- 4 years ago
Thanks I actually used a different solution where i refered to the column by its number 0 = first column.
#"Renamed Columns3" = Table.RenameColumns(#"Changed Type1",{{Table.ColumnNames(#"Changed Type1"){0}, "Source"}}),
1. Insert an Index column just before #"Promoted Headers".
2. Issue this statement (This would change your first row to a column name "Source Name"
Table.ReplaceValue(#"Added Index",each [Source.Name],each if [Index] = 0 then "Source Name" else [Source.Name],Replacer.ReplaceValue,{"Source.Name"})3. Now delete the Index column
4. After this you can promote headers.
Thanks I actually used a different solution where i refered to the column by its number 0 = first column.
#"Renamed Columns3" = Table.RenameColumns(#"Changed Type1",{{Table.ColumnNames(#"Changed Type1"){0}, "Source"}}),