Platform how-to
Unpivoting wide exports in Power Query, step by step
A column per month looks fine in a spreadsheet and fights you in a report. Unpivoting turns it into the long shape Power BI expects, and it takes about five clicks.

Jonah, the controller at Tidewater Clinics Group, gets the annual budget as a spreadsheet: one row per department, one column per month, Jan through Dec. It reads well on screen. But when he loaded it into Power BI, he couldn’t put months on a chart axis, couldn’t relate the budget to the date table, and every new “variance by month” visual needed twelve separate fields.
The fix is to unpivot. Power Query does it natively, and once it’s set up, it repeats on every refresh.
Wide versus long
A wide table has one column per period or category. A long table has one row per item per period, with the period in its own column. Reports, slicers and relationships all expect long.
| Department | Jan | Feb | Mar | … Dec |
|---|---|---|---|---|
| Marketing | 41,800 | 43,200 | 44,900 | … |
| Sales | 57,500 | 58,100 | 60,400 | … |
| Operations | 70,200 | 71,600 | 72,300 | … |
| Department | Month | Budget |
|---|---|---|
| Marketing | Jan | 41,800 |
| Marketing | Feb | 43,200 |
| Marketing | Mar | 44,900 |
| Sales | Jan | 57,500 |
- LoadHome > Transform data
- Promote headersFirst row becomes names
- Unpivot Other ColumnsKeep Department
- Rename and typeMonth, Budget, real date
Step by step
Load the file into Power Query
In Power BI Desktop, use Home > Get data to pick the file, then Transform Data in the preview (or Home > Transform data for a query you already have). In Excel, use Data > From Table/Range or Data > Get Data.
Promote headers and remove junk rows
If the month names appear as the first data row, use Home > Use First Row as Headers (also under Transform). Remove title rows or blank rows above it with Home > Remove Rows > Remove Top Rows, and drop any total row or column so it doesn’t get unpivoted as a month.
Select the columns to keep, then unpivot the rest
Select the identifier columns, here just Department. Then go to Transform > Unpivot Columns dropdown and choose Unpivot Other Columns (it’s also on the right-click menu). Power Query produces two new columns, Attribute and Value.
Unpivot Other Columns is usually the right choice for exports, because if next year’s file adds a column, it gets unpivoted too. If you select the month columns and choose Unpivot Columns instead, the step records which columns to keep, so new columns are also picked up; Unpivot Only Selected Columns locks in exactly the ones you chose.
Rename and fix types
Double-click the headers to rename Attribute to Month and Value to Budget. Set Budget’s type to Decimal Number or Fixed Decimal Number with Transform > Data Type. Values often arrive as text, which breaks sums.
Turn month names into real dates
“Jan” alone won’t relate to a date table. Add a column with Add Column > Custom Column, for example
Date.FromText("1 " & [Month] & " 2026"), set it to type Date, and relate that column to your date table in Model view.
Check that nothing was lost
- Row count: a wide table of 3 departments by 12 months should become 36 rows. Power Query drops null cells during the unpivot, so fewer rows means some cells were empty. Decide whether that’s right.
- Totals: add a quick total in both shapes, for example a sum of the Budget column versus the original grand total.
- Round trip: on a duplicate query, use Transform > Pivot Column on Month to rebuild the wide table, and compare.
Common snags
- Two header rows (a year above months): merge them into one header first, or unpivot and then split the Attribute column with Split Column > By Delimiter.
- A lookup file explains the column codes: some systems export cryptic column names plus a second file that says what each means. After unpivoting, merge that file in with Home > Merge Queries. We cover this shape in wide exports with a lookup table.
- Inconsistent month spellings: use Replace Values on the Month column before converting to dates. More in cleaning data in Power Query.
Once the budget is long, it fits neatly as a fact table next to actuals, as described in star schema basics. If variance totals then look off, see why Power BI numbers don’t match Excel.
When every export needs reshaping
One unpivot is easy. A dozen sources, each with its own odd layout and each changing shape now and then, is where the hours go.
If that’s more reshaping than you want to maintain, Storek does it for you. Add the files to one place, and it recognizes wide layouts, including the column-codes-plus-lookup pair, and unpacks them into tidy tables. It tells you when a source gains columns, so you can ask questions in plain words.
Sources
- Unpivot columns · Microsoft Learn · checked November 13, 2026
- Data types in Power Query · Microsoft Learn · checked November 13, 2026