Advanced Excel for Data Analytics · Lesson 2 of 3
Power Query: Repeatable Data Import and Cleaning
Create refreshable import steps for type conversion, filtering, appending, and merging spreadsheet data.
Lesson
1. Introduction
Power Query records a sequence of data preparation steps that can be refreshed when a source file changes. It reduces repetitive copy-and-paste work and exposes transformations for review.
2. Understand the concept
Each applied step transforms a table. Set types deliberately, remove only understood errors, and preserve the source fields needed for audit. Append stacks compatible tables; merge joins tables by keys. Validate row counts and unmatched keys after each operation.
3. Syntax and interpretation
Source → Promote headers → Set types → Filter rows → Merge queries → Load resultThe order of steps matters: converting a field before filtering can reveal invalid values that should be inspected.
4. Apply it to an analysis
Create refreshable import steps for type conversion, filtering, appending, and merging spreadsheet data. Start with a small, known example and state what each row or value represents. After the transformation, check row counts, types, keys, and units against the original data. If an assumption fails, stop and investigate instead of presenting the output as a valid result.
5. Common mistakes
- Removing error rows without counting or inspecting why conversion failed.
- Merging on a non-unique lookup key and creating duplicate output rows.
6. Practice task
A refresh produces 20 unmatched product SKUs. What should you do before publishing the report?
7. One possible solution
Inspect and report the unmatched keys, confirm whether the lookup table is stale or the source values need normalization, and reconcile output row counts before publishing.8. Summary and next step
Create refreshable import steps for type conversion, filtering, appending, and merging spreadsheet data. Continue to the next course section and apply this foundation to a different analytics tool or workflow.
Visual guide
Working through Power Query: Repeatable Data Import and Cleaning
-
Step 01
Define
State the question, data grain, and expected output.
-
Step 02
Apply
Use the method and check its assumptions on a small example.
-
Step 03
Verify
Reconcile the result and communicate limitations.
Code examples
Append Queries → JanuaryOrders + FebruaryOrders → OrdersAll
Combines compatible rows into one table with a consistent schema.
OrdersAll[SKU] LEFT JOIN Products[SKU] → ProductName
Adds product descriptions while preserving every order line for reconciliation.
Key points
- Create refreshable import steps for type conversion, filtering, appending, and merging spreadsheet data.
- Check the result against the stated data definition and a representative example.
- Record assumptions and report data-quality limitations rather than hiding them.
Check your understanding
Practice
Your learning progress