Power Query M code
let
Source = YourTable,
KeyColumns = {"ID", "Region"},
Unpivoted = Table.UnpivotOtherColumns(Source, KeyColumns, "Attribute", "Value")
in
Unpivoted
Unpivots every column except a named list of key columns, useful when the columns to unpivot vary between refreshes.
let
Source = YourTable,
KeyColumns = {"ID", "Region"},
Unpivoted = Table.UnpivotOtherColumns(Source, KeyColumns, "Attribute", "Value")
in
Unpivoted
List every column that should stay as-is in KeyColumns; everything else becomes Attribute/Value pairs.
Browse all 145 snippets in the Power Query M Code Snippets, or search the library for something similar to Unpivot All Columns Except Key Columns.