Table.PromoteHeaders is a Power Query M function that promotes the first row of a table as the new column headers. The function returns a table with the first row values as column names, according to specified options.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Table.PromoteHeaders(
table as table,
optional options as nullable record,
) as table
Description
Table.PromoteHeaders promotes the first row of values as new column headers in the table. It includes options like PromoteAllScalars for promoting all scalar values and Culture for specifying data culture.
Examples
Promote the first row of values in the table.
// Output: Table.FromRecords( {[CustomerID = 1, Name = "Bob", Column3 = #date( 1980, 1, 1 )]} )
Table.PromoteHeaders(
Table.FromRecords( {
[Column1 = "CustomerID", Column2 = "Name", Column3 = #date( 1980, 1, 1 )],
[Column1 = 1, Column2 = "Bob", Column3 = #date( 1980, 1, 1 )]
} )
)
Promote all the scalars in the first row of the table to headers.
// Output: Table.FromRecords( {[1 = 1, Name = "Bob", #"1/1/1980" = #date( 1980, 1, 1 )]} )
Table.PromoteHeaders(
Table.FromRecords( {
[Rank = 1, Name = "Name", Date = #date( 1980, 1, 1 )],
[Rank = 1, Name = "Bob", Date = #date( 1980, 1, 1 )]}
),
[PromoteAllScalars = true, Culture = "en-US"]
)
Related functions
Other functions related to Table.PromoteHeaders are:
2023-2026 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy