Building a Reliable Power Query Report
A practical guide to building, checking, and refreshing a repeatable Power Query report.
Prepare, Append, and Reshape the Sources
Prepare, Append, and Reshape the Sources
A reliable Power Query report starts with sources that use consistent structures. For the monthly-sales example, each source has ProductID, Region, and month columns such as Jan and Feb; a separate product lookup has ProductID and Category. Before combining the sales sources, promote headers if needed, standardize column names, data types, and key formats, remove irrelevant rows, and resolve missing or invalid keys. Consistent inputs make the saved steps more likely to keep working when refreshed.
Append tables, then check the count
Appending combines rows. Power Query matches fields by column header name, not by column position. If one source does not contain a column present in another, the combined result has nulls for that field in the rows from the source without it. After appending, check that the row count equals the sum of the source row counts; a mismatch is a reason to investigate the inputs or transformation.
Unpivot repeated measures
Month columns store periods across the columns. Unpivoting turns them into two fields, such as Month and Sales, so each row represents one product, region, and month. When the identifier columns are known but new month columns may be added later, Unpivot other columns can accommodate those additional measures.
For example, 1,000 appended sales rows with four monthly columns could produce up to 4,000 rows after unpivoting. The exact count depends on blank values and the source layout. The larger row count does not itself mean the sales total changed: unpivoting changes the structure, not the sum of populated sales values. Compare totals using the same grain and filters before and after the transformation.
Merge Carefully and Validate the Report
Merge Carefully and Validate the Report
Once the sales rows are prepared, merge the product lookup on ProductID to add Category. Choose the join type based on which rows the report must retain. A left outer join keeps every sales row, including rows whose product key has no match; the lookup fields for an unmatched key will be missing.
If each sales row is intended to match one lookup record, first confirm that the lookup key is unique. Duplicate ProductID values in the lookup can match a sales row more than once, multiplying fact rows and potentially inflating totals. After merging, check for unmatched keys and compare the sales-row count and sales total before and after. For a many-to-one lookup, both should remain unchanged. If either differs, investigate rather than treating the change as a formatting issue.
Check the finished shape
Finalize the report by setting data types, renaming fields clearly, removing temporary columns, and arranging the output columns. Then verify that column names, order, and types are as expected; that there is one row per intended grain; and that there are no unexpected nulls or errors. Check whether row counts and totals are plausible, comparing totals at the same grain and with the same filters.
If row order matters, sort at the end. Power Query does not guarantee that an earlier sort will survive every downstream operation. These checks complement one another: a plausible total alone does not establish that the schema, row grain, keys, or ordering are correct.
Load and Refresh Reliably
Load and Refresh Reliably
A repeatable report is a saved sequence of transformations that can be rerun when its source data changes. Load the finished query to its intended destination, such as a worksheet table or the Data Model. If an intermediate query is needed for transformation but is not itself a report output, keep it connection-only.
When source data changes, refresh the saved query rather than rebuilding its steps. Confirm that the refresh succeeds, the destination updates, and the validation checks still pass. Refresh settings can control whether connections refresh on demand, when the workbook opens, or at specified intervals. The report is ready to rely on only after both the refreshed output and its checks have been confirmed.