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.

Storek team4 min read

Funnel of 432 budget rows after unpivoting, 144 for Operations, 36 in Q4 and 9 over plan, with the Q4 stage opened into a table of month, cost centre, budget line and amount.
Sample dataA wide budget export reshaped, then drilled. Illustrative data.

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.

DepartmentJanFebMar… Dec
Marketing41,80043,20044,900…
Sales57,50058,10060,400…
Operations70,20071,60072,300…
Sample dataWide: a column per month.
DepartmentMonthBudget
MarketingJan41,800
MarketingFeb43,200
MarketingMar44,900
SalesJan57,500
Sample dataLong: one row per department per month.
  1. LoadHome > Transform data
  2. Promote headersFirst row becomes names
  3. Unpivot Other ColumnsKeep Department
  4. Rename and typeMonth, Budget, real date
Four moves, recorded as Applied Steps, replayed on every refresh.

Step by step

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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

  1. Unpivot columns · Microsoft Learn · checked November 13, 2026
  2. Data types in Power Query · Microsoft Learn · checked November 13, 2026

Data loadingData pipelinesBI tools

FAQ

Questions, answered.

What does unpivot do in Power Query?

It turns columns into rows. A table with one column per month becomes a table with an Attribute column holding the month name and a Value column holding the number, so each row is one department in one month.

What is the difference between Unpivot Columns and Unpivot Other Columns?

Unpivot Other Columns keeps the columns you selected and unpivots everything else, so a new month column added later is unpivoted on refresh. Unpivot Columns and Unpivot Only Selected Columns work on the columns you picked, so new columns are left as they are.

Why are my unpivoted values text?

If the header row was read as data, or the columns were typed as text before the unpivot, the Value column ends up as text. Promote headers first, then set the Value column's data type to a number after the unpivot.

Can I reverse an unpivot?

Yes. Select the Attribute column and use Transform > Pivot Column, choosing the Value column as the values. It's handy for checking that nothing was lost.

Book a demo

See your own data, delivered.

30 minutes. Your data or our sample. No slide deck. Pick a time straight after the form.