Table.DemoteHeaders

Table

Moves the column headers down into the first row of data, replacing them with default column names.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Table.DemoteHeaders(table as table) as table

Parameters

NameTypeRequiredDescription
tabletableYesThe table whose headers should be demoted.

Return Value

tableThe table with previous column names as the first data row and default column names (Column1, Column2, …) as the new headers.

Remarks

Table.DemoteHeaders is the inverse of Table.PromoteHeaders. It is useful when you need to prepend the current column names as a data row — for example, before combining tables with different headers into a single flat list, or before pivoting/reshaping data where the headers themselves are values.

After demotion, columns are named Column1, Column2, etc.

Examples

Example 1: Demote headers to prepare for header-as-data reshaping

let
    Source = #table({"Name", "Q1", "Q2"}, {{"Alice", 100, 200}, {"Bob", 150, 250}}),
    Demoted = Table.DemoteHeaders(Source)
in
    Demoted
Applied Steps

The final output — moves the column headers (Name, Q1, Q2) into the first data row and renames all columns to Column1, Column2, Column3.

Column1
Column2
Column3
1NameQ1Q2
2Alice100200
3Bob150250

Example 2: Round-trip — demote then re-promote

let
    Source   = #table({"City","Sales"},  {{"New York", 500}, {"Chicago", 300}}),
    Demoted  = Table.DemoteHeaders(Source),
    Promoted = Table.PromoteHeaders(Demoted)
in
    Promoted

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks
Contributors
kyleamueller