The request

From Thomas Whitaker, Head of Merchandising
Your goal
The Source step is the Q1 2025 export: category (only on the first row of each group), subcategory, Jan, Feb, Mar. Fill the category down, unpivot the three month columns, and rename the new columns to month and units.
- Show exactly
categorysubcategorymonthunitsnot done yet - 75 rowsnot done yet
Your query steps
| category | subcategory | Jan | Feb | Mar | |
|---|---|---|---|---|---|
| 1 | Decor | Candles | 80 | 56 | 115 |
| 2 | Mirrors | 109 | 93 | 120 | |
| 3 | Vases | 63 | 88 | 97 | |
| 4 | Wall Art | 85 | 63 | 68 | |
| 5 | Furniture | Beds | 17 | 13 | 21 |
| 6 | Chairs | 17 | 7 | 23 | |
| 7 | Sofas | 18 | 20 | 37 | |
| 8 | Storage | 16 | 13 | 6 | |
| 9 | Tables | 2 | 3 | 11 | |
| 10 | Kitchen | Cookware | 76 | 64 | 65 |
| 11 | Dinnerware | 158 | 130 | 168 | |
| 12 | Glassware | 39 | 57 | 59 | |
| 13 | Utensils | 56 | 36 | 57 | |
| 14 | Lighting | Floor Lamps | 39 | 29 | 39 |
| 15 | Pendants | 53 | 37 | 57 | |
| 16 | Sconces | 61 | 34 | 39 | |
| 17 | Table Lamps | 81 | 27 | 40 | |
| 18 | Outdoor | Grilling | 41 | 23 | 54 |
| 19 | Outdoor Lighting | 28 | 14 | 64 | |
| 20 | Patio Furniture | 12 | 10 | 38 | |
| 21 | Planters | 0 | 5 | 5 | |
| 22 | Textiles | Bedding | 57 | 57 | 55 |
| 23 | Pillows | 99 | 52 | 85 | |
| 24 | Rugs | 86 | 44 | 57 | |
| 25 | Throws | 82 | 71 | 88 |
Loading the editor…
Reference solution
Mote checks your result
Press Check. Mote fills in your answer and compares it with what the report needs.
What Thomas gets, and why
The lesson
Thomas’s export was made for people: months across the top, the category written once per
group, like a printed report. A model needs it the other way round, one row per fact
(subcategory, month, units), so that a single month column can go on an axis and a single
units column can be summed.
Fill the gaps first
Fill down: category
The export only writes Decor on the first Decor row; the next three rows are blank (null) but
belong to Decor too. Fill Down copies the last value above into each empty cell, until the
next value appears. In Power BI: right-click the category header → Fill → Down (or
Transform → Fill → Down). The M:
Table.FillDown(Source, {"category"})
Fill Up does the reverse, for reports that write the label at the bottom of a group. Both
only fill nulls. If the blanks are empty text, first use Replace Values, finding nothing and
replacing with null.
Unpivot: columns into rows
Unpivot columns: Jan, Feb, Mar
In Power BI: select the three month columns, then Transform → Unpivot Columns. Each source row
becomes three rows; the column names go into a new Attribute column and the numbers into
Value:
| category | subcategory | Jan | Feb | Mar |
|---|---|---|---|---|
| Decor | Candles | 80 | 56 | 115 |
becomes
| category | subcategory | Attribute | Value |
|---|---|---|---|
| Decor | Candles | Jan | 80 |
| Decor | Candles | Feb | 56 |
| Decor | Candles | Mar | 115 |
Twenty-five rows become 75. Rename the two new columns so the model reads well:
Rename column: Attribute to month
Rename column: Value to units
Unpivot Other Columns: ready for April
Finance will send Q2 with Apr, May, Jun. A step that names Jan, Feb and Mar won’t pick up
the new months. The robust version selects the columns that stay, category and
subcategory, and uses Transform → Unpivot Columns → Unpivot Other Columns. Its M names the
columns to keep, so any month column the file brings is unpivoted:
Table.UnpivotOtherColumns(#"Filled Down", {"category", "subcategory"}, "Attribute", "Value")
Here, with exactly three months, both give the same table. In Power BI, prefer Unpivot Other Columns for any export that grows sideways.
Pivot: the way back
Transform → Pivot Column does the opposite: it turns the values of one column into column headers. Useful for a small summary table, rarely for a model.
Common mistakes
- Unpivoting first. Blanks move into the long table and the category is lost.
- Leaving Attribute and Value. Nobody knows what
Valuemeans in the Data pane. - Months as text with no order.
Jan,Feb,Marsort alphabetically as Feb, Jan, Mar. Relate the data to the ‘Date’ table, or add a month number to sort by.
Lantern lit!
Practised: power queryunpivot columnsunpivot other columnsfill downtidy datarename column
- Solved
- No hints
- First run
