Table.Transpose

Table

Transposes the table so that rows become columns and columns become rows.

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

Syntax

Table.Transpose(table as table, optional columns as any) as table

Parameters

NameTypeRequiredDescription
tabletableYesThe table to transpose.
columnsanyNoOptional. Column names for the transposed result. Can be a list of names or a table type.

Return Value

tableA new table where each original column becomes a row and each original row becomes a column.

Remarks

Table.Transpose rotates a table 90 degrees: each column becomes a row and each row becomes a column. The original column headers are not automatically preserved — they become the values in the first row of the transposed result (or the first column, depending on orientation). This means transposing almost always requires a follow-up step, typically Table.PromoteHeaders to elevate the first row into column names, or Table.DemoteHeaders to push original headers into data first.

The optional columns parameter controls the column names of the transposed output. Supplying it avoids the need for Table.PromoteHeaders by setting column names directly. If omitted, columns are named Column1, Column2, etc.

Table.Transpose is useful for pivoting "wide" month-column datasets into a "long" time-series format, or for converting a key-value column layout into a horizontal record. It does not fold to data sources, so for large datasets avoid transposing unless necessary. For more structured pivoting by dimension, consider Table.Pivot and Table.Unpivot instead.

Examples

Example 1: Transpose a monthly metrics table and promote headers

let
    Source     = #table({"Metric","Jan","Feb","Mar","Apr"},
                         {{"Revenue",100,200,150,300},{"Cost",50,80,60,120}}),
    Transposed = Table.Transpose(Source),
    Promoted   = Table.PromoteHeaders(Transposed)
in
    Promoted
Result
Metric
Revenue
Cost
1Jan10050
2Feb20080
3Mar15060
4Apr300120

Example 2: Transpose Employees table and supply column names directly

let
    Subset = #table(
        {"EmployeeID","FullName","Department","Salary"},
        {{"E001","alice smith","Sales",55000},{"E002","BOB JONES","Engineering",95000}}
    ),
    Transposed = Table.Transpose(Subset, {"Field","Employee1","Employee2"})
in
    Transposed
Result
Field
Employee1
Employee2
1EmployeeIDE001E002
2FullNamealice smithBOB JONES
3DepartmentSalesEngineering
4Salary5500095000

Example 3: Round-trip: demote headers, transpose, and promote to reshape a wide table

let
    Wide = #table(
        {"CustomerName","Q1","Q2","Q3","Q4"},
        {{"Alice",100,200,150,300},{"Bob",80,120,90,160}}
    ),
    Demoted    = Table.DemoteHeaders(Wide),
    Transposed = Table.Transpose(Demoted),
    Promoted   = Table.PromoteHeaders(Transposed)
in
    Promoted
Result
CustomerName
Alice
Bob
1Q110080
2Q2200120
3Q315090
4Q4300160

Compatibility

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