Power QueryExercises

Table.UnpivotOtherColumns

Table function · By Tahir Nas · Examples run in our simulator · Published · Updated

Turns all columns except the listed ones into attribute/value rows.

When to use it

Use it to turn a wide layout (one column per month or product) into a long one with one row per item and attribute. It's the right choice when new period columns appear over time, because every column except the identifiers is unpivoted.

Syntax

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

Parameters

pivotColumns
Columns to keep as identifiers.

Returns

A long table.

Example

Table.UnpivotOtherColumns(#table({"Item", "Jan", "Feb"}, {{"Kite", 3, 5}}), {"Item"}, "Month", "Units")

Result

ItemMonthUnits
KiteJan3
KiteFeb5

Example: months to rows, then typed

After unpivoting, the attribute column is text, so convert it if it holds dates or numbers.

Table.TransformColumnTypes(Table.UnpivotOtherColumns(#table({"Item", "2026-01", "2026-02"}, {{"Kite", 3, 5}}), {"Item"}, "Month", "Units"), {{"Units", Int64.Type}})

Result

ItemMonthUnits
Kite2026-013
Kite2026-025

Both results are produced by the Power Query Exercises simulator, an independent implementation of a documented subset of M, and checked on every build.

Good to know

Common mistakes

The matching command in Excel

Excel for Windows
Select the columns to keep > right-click > Unpivot Other Columns
What you see
Every other column becomes Attribute and Value pairs, including columns added later.

Paths are for the Power Query editor in Excel for Microsoft 365, checked against Microsoft's documentation on 8 November 2026: Unpivot columns (Microsoft Learn).

Exercises that use Table.UnpivotOtherColumns

Learn more

Related functions

Official documentation: Table.UnpivotOtherColumns on Microsoft Learn.