OpenBI Docs Buy

Table.PromoteHeaders

Makes the first row the header: its values name the columns, and the row itself goes.

Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Table.PromoteHeaders(table as table, optional options as nullable record) as table
ParameterTypeDescription
tabletableThe table whose first row holds the names.
optionsnullable record
optional
A record: PromoteAllScalars = true also promotes numbers, dates and logicals, written as text; Culture says how they are written.

Returns

table. The rows after the first, the columns named from it.

Remarks

  • By default only text is promoted: a number, a date or null in the first row leaves its column with a default name, such as Column3.
  • Names that repeat get _1, _2 and so on added: two Sales columns become Sales and Sales_1.
  • With PromoteAllScalars, a date or number is written as the culture writes it: the option Culture, else the query's (a date of 1 March 2026 names its column 3/1/2026 in en-US, 01.03.2026 in nb-NO).
  • Files without a header row come in as Column1, Column2 ...; Transform data adds this step, then Changed Type, when the first row holds the names.

Examples

Names from the first row

let
    Raw = #table({"Column1", "Column2", "Column3"}, {{"Product", "Shop", "Sales"}, {"Chair", "Oslo", 120}, {"Desk", "Bergen", 340}})
in
    Table.PromoteHeaders(Raw)
ProductShopSales
ChairOslo120
DeskBergen340

Years as headers

The years are numbers: only PromoteAllScalars makes names of them.

let
    Raw = #table({"Column1", "Column2", "Column3"}, {{"Product", 2025, 2026}, {"Chair", 10, 12}})
in
    Table.PromoteHeaders(Raw, [PromoteAllScalars = true])
Product20252026
Chair1012

A name used twice

Table.PromoteHeaders(#table({"Column1", "Column2", "Column3"}, {{"Product", "Sales", "Sales"}, {"Chair", 120, 130}}))
ProductSalesSales_1
Chair120130

Table.DemoteHeaders, Table.RenameColumns, Table.RemoveFirstN, Table.TransformColumnTypes.

Last updated · OpenBI Studio 0.3.79