How to Keep Blank Rows When You Unpivot in Power Query
You have three sites and three months to report. After unpivoting in Power Query, you get four rows and one site disappears entirely. The sum still matches. The missing rows are the months for which no count was submitted. Microsoft’s Table.Unpivot example shows that null values leave no row in the output. The same symptom came up in the Microsoft Fabric Community. Microsoft’s Unpivot reference and the community question.
Decide what a blank means before reshaping the data
In this synthetic inspection log, every site is expected to submit a count each month. A confirmed zero means the site submitted its count and recorded no inspections. An empty cell means the count has not been submitted. If your source also has months that do not apply, track those separately when setting the expected count. Keep one source row per site and confirm that the columns are limited to the periods you want.
| Site | 2026-09 | 2026-10 | 2026-11 |
|---|---|---|---|
| North | 12 | 0 | |
| South | 8 | 5 | |
| West |
Keep the missing site-months while you unpivot
Enter the grid in Excel and leave the five empty cells blank. Format it as a table named SiteCounts, choose Data > From Table/Range, and open the Advanced Editor. The query below uses a temporary text value that appears nowhere in the input. It replaces nulls before unpivoting, restores them immediately afterward and adds a reporting-status column. The measure columns use type any only while they may contain the temporary text. The final Count column is numeric and can still contain nulls. Microsoft’s ReplaceValue reference.
let
Source = Excel.CurrentWorkbook(){[Name="SiteCounts"]}[Content],
Months = {"2026-09", "2026-10", "2026-11"},
Marker = "__NO_COUNT__",
UntypedMonths = Table.TransformColumns(
Source, List.Transform(Months, (name) => {name, each _, type any})),
Marked = Table.ReplaceValue(
UntypedMonths, null, Marker, Replacer.ReplaceValue, Months),
Long = Table.Unpivot(Marked, Months, "Month", "Count"),
Restored = Table.ReplaceValue(
Long, Marker, null, Replacer.ReplaceValue, {"Count"}),
Typed = Table.TransformColumnTypes(Restored, {{"Count", type number}}),
WithStatus = Table.AddColumn(
Typed, "Reporting status", each if [Count] = null then "Missing" else "Reported", type text)
in
WithStatus
On refresh, update the Months list to match your expected headers. If a month column is entirely absent, investigate the missing header first. If your file uses empty strings or spaces, normalize those entries to null where you have confirmed they mean missing. Leave any valid zeros intact. Make sure the temporary value never appears in the source.
Check coverage as well as the count total
For the synthetic grid, the unpivoted table should contain nine site-month rows. Four are Reported, including North’s October zero, and five are Missing. The four reported counts total 25. The average per reported site-month is 25 ÷ 4 = 6.25. Report coverage as four of nine. If you fill the empty cells with zero instead, the sum still reads 25 and the coverage signal disappears. Check that West still has three rows, all marked Missing.
For a one-off comparison in Jolene.pro, supply the source and the reshaped exports in Excel or CSV. Ask which expected site-months are absent from the output, where zeros were recorded in the source, and which source cells support each finding. The synthetic results were checked independently. A live Jolene.pro result was not verified for this example.
If you also combine several versions of the same monthly export, see how to stop double counting when combining monthly CSV files.