Downloads
Power Query MTable: headers and shapeIntermediate

Table.Unpivot

Turns several columns into rows, with one row for each combination of a column and its value.

Syntax
Table.Unpivot(table as table, pivotColumns as list, attributeColumn as text, valueColumn as text) as table

Returns: A long table with an attribute column and a value column.

What it does

Table.Unpivot converts a wide report, with a column for each month, into a long table with one row for each month. The long form is what a summary, a pivot table or a data model needs. The columns you list are the ones that become rows. Every other column is left as it is.

Syntax and arguments

Example

A budget for 2026 has one row for each account and one column for each month. The twelve month columns are turned into rows, so each account has twelve rows.

let
    Source = Excel.CurrentWorkbook(){[Name = "Budget2026"]}[Content],
    Long = Table.Unpivot(
        Source,
        {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"},
        "Month",
        "Budget"
    )
in
    Long

Each month heading becomes a value in the Month column, and each budget figure lands in the Budget column. The Account column is repeated on every row.

Things to watch

In business terms

Budget and forecast grids come out of planning tools with months across the top. Unpivoting them is the step that makes budget versus actual reporting possible in a pivot table or a model.

Related functions

All Power Query M functions · View as Markdown · M basics