Power Query Basics - Clean and refresh a report
Import a Table, record cleaning steps, filter open orders, and load a refreshable regional summary.
By the end, you can
- Load a source Table into Power Query.
- Trim text, set types, filter, and group records.
- Refresh the output without editing or replacing the source.
Before you start: Understand Excel Tables and one-record-per-row datasets. Know that text and numbers are different data types.
In this lesson
Record the cleanup instead of repeating it
Power Query imports and transforms data through a sequence of recorded steps. Refresh runs those steps again against the source. It is useful for recurring attendance exports, monthly sales files, and inventory reports that need the same cleanup each time. The transformation normally leaves the source data unchanged.
O101 | A | B | C | D | |
|---|---|---|---|---|
| 1 | Order ID | Region | Amount INR | Status |
| 2 | O101 | north | 12000 | open |
| 3 | O102 | South | 8000 | Paid |
| 4 | O103 | NORTH | 18000 | Open |
| 5 | O104 | south | 10000 | open |
| 6 | O105 | East | 6000 | Open |
Open the source in Power Query
- Select the complete source, press Ctrl+T, confirm headers, and name the Table RawOrders on Table Design.
- Choose Data > From Table/Range in the Get & Transform Data area. The Power Query Editor opens with a preview.
- Inspect Query Settings > Applied Steps. Excel may automatically add Changed Type. Remove or adjust that step if it interprets a column incorrectly; type errors can occur before later cleaning steps.
Clean, type, and filter the records
- Select Order ID, Region, and Status using Ctrl to select multiple columns. Choose Transform > Format > Trim to remove surrounding spaces.
- Select Region and Status, then Transform > Format > UPPERCASE. Keep the order IDs as text; do not convert identifiers to numbers.
- Set Amount INR to Whole Number using its data-type icon. These example amounts are integers; use an appropriate decimal type for amounts containing paise.
- Filter Status to OPEN. O102 is PAID, so it is excluded.
- Check the four cleaned detail records before summarizing. In Applied Steps, selecting an earlier step lets you inspect the preview at that point.
O101| A | B | C | D | |
|---|---|---|---|---|
| 1 | Order ID | Region | Amount INR | Status |
| 2 | O101 | NORTH | 12000 | OPEN |
| 3 | O103 | NORTH | 18000 | OPEN |
| 4 | O104 | SOUTH | 10000 | OPEN |
| 5 | O105 | EAST | 6000 | OPEN |
Group by region and load the result
- Choose Home > Group By. Group on Region; set the new column name to Total INR, Operation to Sum, and Column to Amount INR.
- Sort Region ascending. The result should contain EAST, NORTH, and SOUTH once each.
- Name the query OpenRevenueByRegion in Query Settings.
- Choose Home > Close & Load > Close & Load To, select Table and New Worksheet, then load the result. If the dialog is not offered in your version, use the query's Load To option from Queries & Connections.
- Reconcile the loaded total: ₹6,000 + ₹30,000 + ₹10,000 = ₹46,000.
6000| A | B | |
|---|---|---|
| 1 | Region | Total INR |
| 2 | EAST | 6000 |
| 3 | NORTH | 30000 |
| 4 | SOUTH | 10000 |
Reuse the query next time
- Append O106, East, text amount 2000, and Open inside RawOrders.
- Choose Data > Refresh All and wait for the query to finish.
- Verify EAST is now ₹8,000, NORTH remains ₹30,000, SOUTH remains ₹10,000, and the total is ₹48,000.
- Use the same pattern to standardize department names before an attendance report.
- For recurring files, import from a supported file or folder connector and retain a consistent schema.
- Load cleaned detail records instead of grouping when a later PivotTable needs the transaction-level data.
Common mistakes and practical checks
- Wrong totals: inspect the filter and Group By operation. Counting rows is different from summing Amount INR.
- Conversion errors: inspect the original values and choose a suitable type. For regional date or decimal conventions, use Change Type > Using Locale where appropriate.
- Broken steps after renamed columns: repair the first failing Applied Step against the source schema, then check later steps.
- Missing added records: confirm they are inside RawOrders, refresh, and inspect the source step.
- Unexpected duplicate groups: clean spaces and capitalization before grouping; review nonstandard characters separately.
- Removed errors hide a problem: investigate why values failed instead of automatically deleting every affected record.
Check your understanding
Choose an answer for instant feedback. You can try again; answers stay only on this page.