Forum Discussion
Copy value from one column header to another?
- 3 years ago
firstly, import your file into Source without headers. ie, the columnnames will be "column 1","column2",.....
secondly, click the "fx", left of the formula editor bar
then use these code into the formula area.
=let a=List.Skip(Table.ColumnNames(Source)) in Table.RenameColumns(Source,List.Zip({a,List.Accumulate(List.Skip(List.Zip(List.FirstN(Table.ToRows(Source),2))),{{},null},(x,y)=>{x{0}&{Text.Combine({y{0}??x{1},y{1}},"-")},y{0}??x{1}})}))
firstly, import your file into Source without headers. ie, the columnnames will be "column 1","column2",.....
secondly, click the "fx", left of the formula editor bar
then use these code into the formula area.
=let a=List.Skip(Table.ColumnNames(Source)) in Table.RenameColumns(Source,List.Zip({a,List.Accumulate(List.Skip(List.Zip(List.FirstN(Table.ToRows(Source),2))),{{},null},(x,y)=>{x{0}&{Text.Combine({y{0}??x{1},y{1}},"-")},y{0}??x{1}})}))