MIS Intermediate — Cleaning, Aggregating, and Reporting on the Practice Dataset
This page assumes you've read Fundamentals and know the four files' quirks. Everything here is written against that exact dataset — open it alongside this page.
Cleaning the dirty columns
Before any SUMIFS, pivot table, or SQL aggregate touches unit_price or qty, strip and cast them:
=VALUE(SUBSTITUTE(TRIM(B2),"$","")) — TRIM removes stray leading/trailing spaces, SUBSTITUTE removes a $ if present, VALUE converts the result to a real number.Build this cleanup once — as a helper column in Excel, or a CTE/view in SQL — and reuse it everywhere, rather than repeating the SUBSTITUTE/REPLACE logic in every single formula or query.
Filling the blank region from `reps.csv`
A region-accurate report needs to join sales to reps on rep_id and prefer the rep's region over a blank sales.region:
=IF(TRIM(C2)="",XLOOKUP(D2,Reps[rep_id],Reps[region]),C2) — if the sales row's region is blank, look up the rep's region instead.COALESCE(NULLIF(TRIM(s.region), ''), r.region) after joining reps AS r ON s.rep_id = r.rep_id.De-duplicating before aggregating
A duplicate full-row in sales.csv double-counts that order's revenue. In SQL, SELECT DISTINCT or a GROUP BY order_id (since order_id should be unique per real order) removes duplicates before any revenue sum runs. In Excel, Power Query's "Remove Duplicates" step on order_id, placed before any aggregation step in the query, does the same thing — removing duplicates after a pivot has already summed them is too late.
Pivot tables on this dataset
A pivot table with region (cleaned) in Rows, order_date grouped by Month in Columns, and qty * unit_price (cleaned) as a calculated field in Values reproduces a monthly regional revenue report — but only once the underlying data is cleaned first, which is why Power Query, not the pivot table itself, is where the cleanup steps above belong in a real workbook.
Where Power Query fits
Power Query is the right place to do the cleaning steps above once, as a repeatable, refreshable query, rather than as one-off helper-column formulas that someone has to remember to redo every time the source file refreshes:
sales.csv.unit_price and qty (Power Query's own Text.Trim/Text.Replace or the Transform ribbon).reps.csv on rep_id to pull in a clean region.order_id.See the Interview page's hands-on tasks for fully worked SQL and Excel versions of every pattern on this page, each with its verified output stated in the answer.

