Power Query M code
let
Source = YourTable,
UnpivotedColumns = Table.UnpivotOtherColumns(Source, {"ProductID", "ProductName"}, "Month", "Sales")
in
UnpivotedColumns
Turns wide columns (like one column per month) into Attribute/Value pairs.
let
Source = YourTable,
UnpivotedColumns = Table.UnpivotOtherColumns(Source, {"ProductID", "ProductName"}, "Month", "Sales")
in
UnpivotedColumns
List the columns to keep as-is; every other column gets unpivoted into Month/Sales pairs.
Browse all 145 snippets in the Power Query M Code Snippets, or search the library for something similar to Unpivot Columns.