The analyst changes one workbook setting when the month closes.
Monthly Sales and Margin Workbook Rebuild
An Excel and Power Query rebuild that replaces the monthly copying of regional sales files with a repeatable refresh, visible adjustments and a checked sales and margin pack.
The June workbook is ready to issue after all 192 regional files are present, eight checks pass and the late Scotland file is reviewed.
A recurring sales routine
One reporting analyst used to open regional files, repair columns and copy the results into the monthly margin pack.
Eight regional sales administrators send invoice line exports to a wholesale company's reporting analyst. The analyst adds product costs, checks customer regions, applies approved finance adjustments and prepares the pack for the sales director.
A missing file, renamed column, duplicate invoice line or unknown product can change sales or margin without being obvious in a copied worksheet. The decision is simple: can the June pack be issued, and what must be corrected first?
All 192 registered files are present and all 8 checks pass. The Scotland file arrived late, so the analyst reviewed its schema and totals before the sales director issued the pack.
How the refresh works
Power Query repeats the preparation. People keep the decisions.
The workbook combines regional files, assigns data types, maps customers and products and checks each invoice line. Finance still approves adjustments, the analyst reviews late or failed records and the sales director decides whether to issue the pack.
- 01Receive
Eight regional CSV files arrive for each month.
- 02Combine
A folder query keeps the filename and appends the rows.
- 03Prepare
Power Query assigns dates, numbers, percentages and currency types.
- 04Check
Keys, mappings, quantities and line values are tested.
- 05Review
Finance approves adjustments and the analyst reviews late or failed records.
- 06Issue
The sales director receives the pack only after the checks pass.
The Scotland CSV arrived after the expected time. It is still accepted because the file was reviewed, the columns matched and every report check passed before the sales director issued the pack.
Start with the working workbook
The June review sits inside the workbook that combines and checks the regional files.
The retained data contains 150,000 invoice lines in 192 CSV files. All 8 report checks pass. The workbook records one late file as reviewed and includes approved adjustments only.
192 of 192 present
Lewis Grant file received late
48 approved items included
8 of 8 passed
READY TO ISSUE
The retained workbook shows £9,942,644 of June sales, £3,952,326 of margin and a ready to issue decision after eight checks pass.
Focused issue-decision worksheet
The compact workbook view keeps the month-end issue decision legible.
This is a second worksheet view from the same verified XLSX, prepared for smaller evidence and card surfaces. It keeps the late Scotland file, Lewis Grant as its owner and the issue checks beside the decision. The adjustment line shows that approved changes enter the result while pending changes remain outside it, before the revenue-to-margin bridge reaches the June margin.
The card follows the month-end handover: review the late file, include only approved changes, reconcile £9,942,644 of sales to £3,952,326 of margin, then issue the pack.
Inspectable Power Query
The workbook contains a real folder query, transform function and staged M code.
The query sequence reads the regional folder, keeps the filename, assigns types before joins and sends failed rows to a separate result. The M code and all 15 embedded query items remain in the XLSX.
Filename, modified time, region and reporting month stay attached to each row.
The sample file defines the expected columns and types.
Unknown customer, product or cost records stay out of the reported figures.
Only accepted invoice lines and approved finance adjustments reach the pack.
The complete query definition is retained in build/power_query_steps.m and inside the workbook's DataMashup package.
June adjustment bridge
The workbook shows how invoice-line sales became the reported June result.
The bridge keeps the June sales review focused on the numbers the sales director signs off. Accepted invoice lines total £9,944,369. Approved finance adjustments reduce the month by £1,725, so the issued pack reports £9,942,644.
One invoice line
REG-202601-004243 can be followed from the Scotland CSV to January sales and margin.
The trace is generated from the retained invoice records. It is not a story added to the website after the workbook was built.
The Scotland file records 96 units and £1,609 of sales. Power Query maps Chocolate frogs 250g · Display pack, adds its standard cost and retains a finance-approved £125 correction.
The accepted row enters January 2026 once, at £1,734 sales and £1,241 margin.
- 01Regional CSV
2026-01_scotland_sales.csvREG-202601-004243 · 96 units · £1608.77
The regional file retains the invoice line and the original Wide World Importers benchmark key. - 02Typed Power Query row
stg_TypedSalesInvoice date 2026-01-31 · product PROD-1132
Power Query assigns the date, number and currency types before any join. - 03Customer and product mapping
stg_MappedSalesScotland · Chocolate frogs 250g · Display pack · unit cost £5.13
The line receives its reporting region, product description and approved cost. - 04Approved adjustment
ADJ-202601-001£125.00 price correction
The finance-approved correction remains visible instead of replacing the source value. - 05Validation
val_ReleaseChecksAccepted
The key is unique, references exist and quantity, price and line value agree. - 06Monthly sales and margin output
2026-01 · Scotlandreported sales £1733.77 · margin £1241.29
The accepted line contributes once to its month and region.
Before the pack is issued
Every invoice line and finance adjustment has a recorded result.
The supplied set passes all 8 checks. A separate failed refresh shows what happens when a file is missing, a column changes, an invoice is copied twice or an adjustment has not been approved. Each failed row keeps the reason and the team that must act.
- FILE-01All 192 regional files are present
Each region has supplied one file for every reporting month.
- Result
- PASS
- Affected rows
- 0
- SCHEMA-01Every file has the expected columns
A renamed or missing column stops the combine step before totals change.
- Result
- PASS
- Affected rows
- 0
- KEY-01Invoice-line keys are unique
No invoice line can be counted twice.
- Result
- PASS
- Affected rows
- 0
- REF-01Customer and product codes are mapped
Every accepted line has a region, owner, product and cost.
- Result
- PASS
- Affected rows
- 0
- VALUE-01Source sales plus approved adjustments tie to output
The monthly output contains the accepted source value and approved changes only.
- Result
- PASS
- Affected rows
- 0
- COST-01Product costs tie to monthly output
Margin uses the retained product cost for every accepted line.
- Result
- PASS
- Affected rows
- 0
- ROW-01Every source row is accepted or held
No source row disappears between the folder and the workbook.
- Result
- PASS
- Affected rows
- 0
- ADJ-01Only approved adjustments are included
A pending adjustment remains outside the issued sales and margin figures.
- Result
- PASS
- Affected rows
- 0
Separate failed-refresh fixture
Seven deliberate defects prove that the clean result is not a permissive refresh.
These records never enter the supplied-set totals. They are retained only to prove that missing files, structural changes and invalid business records stop or divert the refresh as designed.
- FIX-01Missing regional file
2026-06_east_sales.csvFILE-01 fails before the pack is issued
- FIX-02Renamed column
2026-06_scotland_sales.csv · product_codeSCHEMA-01 reports the missing product_id column
- FIX-03Duplicate invoice line
REG-202601-004243KEY-01 holds the second row
- FIX-04Unknown product
PROD-9999REF-01 sends the row to Product Finance
- FIX-05Zero quantity
REG-DEFECT-ZEROThe row is held outside the monthly output
- FIX-06Credit without return reason
REG-DEFECT-CREDITThe row is held until a return reason is supplied
- FIX-07Unapproved adjustment
ADJ-202606-PENDINGThe adjustment remains outside reported sales
Data, handover and limits
The workbook is reproducible without pretending that it is a live company system.
The regional files are deterministic non-client data derived from the official Microsoft Wide World Importers sample. Seed 20260726 creates 24 months, eight regions, 1,000 customer mappings and 2,000 product mappings. The transformed dates, reporting variants and edge cases are disclosed in the data manifest.
This build proves a local Excel and Power Query routine. It does not prove a scheduled cloud refresh, shared drive permissions, concurrent editing or a live ERP connection.
Run npm run verify:workbook-rebuild to regenerate the files, workbook, embedded queries, evidence and independent checks. A 26 July 2026 native check records that desktop Excel opened the 19-sheet build without repair and accepted Refresh All against the supplied local files. Today's rebuild passes the independent structural and reconciliation checks; repeat the desktop-open check if the XLSX is rebuilt again before the pack is issued.
- The workbook is a local sample and is not connected to a live sales, finance or product cost system.
- The build does not prove a scheduled cloud refresh, shared drive permissions or concurrent editing.
- Dates, regional assignments, reporting variants and edge cases are deterministic generated data and are not original Microsoft transactions.
- The example demonstrates a controlled routine but does not prove time saved or suitability for every regional reporting process.
Next step
Rebuild a reporting workbook around the real monthly routine.
Start with the workbook people use, a sample of its monthly files and the steps repeated each period.
