Forum Discussion
PowerBI123456
5 years agoPost Partisan
Headers Power Query
Hi, I am combining several files from a folder. The first column (the source column), I need the column header to stay as "source name", but for the other columns, I need to promote the first row...
Fowmy
5 years agoSuper User
PowerBI123456
After promoting the header, go and add the following code, it will rename only the first column:
Table.RenameColumns(#"Promoted Headers",{{Table.ColumnNames(#"Promoted Headers"){0}, "Source.Name"}})
You can paste this code in a blank Query and Check the steps:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCs7PTVVwSSxJVNJRcstMzUlRyEvMTQVyPP0igKRHcIBSrE60kiGQbQTExkBsAhYxBbLMgNgciC2UYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, #"TrasnformFile Column 1" = _t, #"TrasnformFile Column 2" = _t, #"TrasnformFile Column 3" = _t]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
Custom1 = Table.RenameColumns(#"Promoted Headers",{{Table.ColumnNames(#"Promoted Headers"){0}, "Source.Name"}})
in
Custom1After
Learned from ImkeF
________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
PowerBI123456
5 years agoPost Partisan
@Fowmy Thanks! I am actually trying to do the inverse. I am trying to promote the first row as a header for all columns except the first column. Hope that makes sense.