7. Data Cleaning A–Z in Power Query
7.1 A Cleaning Workflow You Can Repeat
Start with a problem
Shahrukh cleans the Pune export in a random order. He changes Amount to a number before removing ₹, and every amount becomes Error. Then he removes duplicates before trimming, so "Kothrud " and "Kothrud" stay as two stores.
Explain simply
Clean in the same order every time: shape, then text hygiene, then types, then blanks and errors, then duplicates, then validity, then restructure, then document. Each stage prepares the next.
Show the data
Before:
| Column1 | Column2 | Column3 | Column4 |
|---|---|---|---|
| Blinkit Pune daily export (fictional practice data) | |||
| Generated 08-04-2026 07:00 IST | |||
| Order ID | Order Date | Store | Amount |
| BLK-401 | 06-04-2026 | "Kothrud " | ₹1,250 |
| BLK-402 | 06-04-2026 | baner | ₹980 |
| BLK-403 | 07-04-2026 | KOTHRUD | ₹450 |
| BLK-403 | 07-04-2026 | KOTHRUD | ₹450 |
| BLK-404 | Baner | ₹320 | |
| Total | ₹3,450 |
About this data: This table uses columns: Column1, Column2, Column3, Column4. This table uses columns: Rows, Amount sum. This table uses columns: Order ID, Order Date (Date), Store, Amount (Fixed decimal). This table uses columns: Stage, What you do, Section. Values shown are the lesson examples already on this page (not a new dataset).
Fictional sample data. Practice file: pq_raw_pune_export.csv (source: src/practice/).
Demonstrate
-
Shape: Remove Top Rows 2 › Use First Row as Headers › filter Order ID does not equal
Total.Your result should look like this:
Table 2: columns Rows Rows 5 (BLK-401, 402, 403, 403, 404) -
Text: Store › Transform › Format › Trim, then Capitalize Each Word.
Your result should look like this:
Table 3: columns Store values Store values Kothrud, Baner, Kothrud, Kothrud, Baner -
Types: Amount › Replace
₹and,with nothing › Fixed decimal. Order Date › Using Locale › Date, English (India).Your result should look like this:
Table 4: columns Amount sum Amount sum 3,450 (5 rows) -
Blanks: Order Date › Replace Values (empty →
null) › Fill › Down.Your result should look like this:
Table 5: columns BLK-404 Order Date BLK-404 Order Date 07-Apr-2026 -
Duplicates: select all columns › Remove Duplicates.
Your result should look like this:
Table 6: columns Rows, Amount sum Rows Amount sum 4 3,000 -
Document: rename steps (6.4).
Show the result
Your result should look like this (fictional sample):
| Order ID | Order Date (Date) | Store | Amount (Fixed decimal) |
|---|---|---|---|
| BLK-401 | 06-Apr-2026 | Kothrud | 1,250 |
| BLK-402 | 06-Apr-2026 | Baner | 980 |
| BLK-403 | 07-Apr-2026 | Kothrud | 450 |
| BLK-404 | 07-Apr-2026 | Baner | 320 |
| Total (4 rows) | 3,000 |
Explain what happened
Each stage removes a cause of failure for the next one: no title rows before typing, no ₹ before converting, no stray spaces before de-duplicating.
Explore further
- Keep the checklist table below as your standard operating procedure.
Detailed reference for this lesson:
Clean in the same order every time. This avoids surprises. Udaharan mhanje, if you remove duplicates before you trim spaces, then "Pune" and "Pune·" are treated as two different values.
| # | Stage | What you do | Section |
|---|---|---|---|
| 1 | Profile | Turn on the column quality, distribution and profile tools; profile the entire dataset | 7.2 |
| 2 | Shape | Remove title rows, promote headers, remove footer/total rows, remove unwanted columns | 7.3 |
| 3 | Text hygiene | Trim, Clean, fix case, standardise spellings | 7.6, 7.9 |
| 4 | Types | Set data types (use Using Locale for Indian dates); convert ₹ text to numbers | 7.7, 7.8 |
| 5 | Blanks & errors | Replace, fill or remove nulls; handle errors | 7.5, 7.15 |
| 6 | Duplicates | Remove full-row duplicates or duplicates by key | 7.4 |
| 7 | Validity | Flag or filter invalid values and outliers | 7.13, 7.16 |
| 8 | Restructure | Split, merge, extract, unpivot, pivot | 7.10–7.12, 7.17 |
| 9 | Combine | Append, merge, folder combine, group | 7.20–7.23 |
| 10 | Document | Rename steps, check query dependencies, turn off load for helper queries | Module 6 |
Ravindra Bagale's Tip
Friends, the mistake I see most is cleaning in a random order, for example changing types before removing ₹ symbols or before promoting headers. Follow the same order every time: remove junk rows, then promote headers, then trim and clean text, then fix values, then set types, then remove duplicates. A fixed order prevents most conversion errors. Clear?
Ravindra Bagale's Tip – मराठी
मित्रांनो, सगळ्यात जास्त दिसणारी चूक म्हणजे कोणत्याही क्रमाने cleaning करणं, उदाहरणार्थ ₹ symbols काढण्याआधी किंवा headers promote करण्याआधी types बदलणं. प्रत्येक वेळी एकच क्रम पाळा: junk rows काढा, then headers promote करा, then text trim आणि clean करा, then values दुरुस्त करा, then types set करा, then duplicates काढा. ठरलेल्या क्रमामुळे बहुतेक conversion errors टळतात. समजलं का?
Ravindra Bagale's Tip – हिंदी
दोस्तों, सबसे ज़्यादा दिखने वाली गलती है किसी भी क्रम में cleaning करना, जैसे ₹ symbols हटाने से पहले या headers promote करने से पहले types बदल देना. हर बार एक ही क्रम अपनाओ: junk rows हटाओ, then headers promote करो, then text trim और clean करो, then values ठीक करो, then types set करो, then duplicates हटाओ. तय क्रम से ज़्यादातर conversion errors बच जाते हैं. समझ आया?
Fix common mistakes
| Wrong result | Reason | Correction |
|---|---|---|
| Every Amount = Error | Changed type before removing ₹ and commas | Clean text first, then set type |
| Two Kothrud stores | De-duplicated or grouped before Trim/case fix | Trim and fix case first |
| Headers wrong after type change | Typed before promoting headers | Shape first |
Practise independently
Practice task
Put these in the right order: Fill Down, Remove Top Rows, Change Type, Trim.
Hints
- Shape, then text, then types, then blanks.
Solution
Remove Top Rows, then Trim, then Change Type, then Fill Down (after replacing empty with null).
Think like a professional
A repeatable order makes your queries predictable for teammates – mention your checklist in interviews.
Revision card