Forum Discussion
Headers Power Query
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 🙂
@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.
- AllisonKennedy5 years agoCommunity ChampionPowerBI123456 you can't promote only some headers - that would cause mismatch in your rows of data, so you essentially have to promote ALL headers and then rename the first column. Hope that makes sense?
- Fowmy5 years agoSuper User
In that case, what do you want to do with the first value of the first column?
You can rename all the columns with the values of the first row except, then I Jay would be the next step?
________________________
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 🙂