Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
โ† Power Query for Data Analysis ยท Lesson 8 of 17

Module Seven

๐Ÿ“– Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
8
Module 7 ยท Power Query for Data Analysis Expert

๐Ÿงน Module Seven: Cleaning Data Like a Pro

Welcome, young data explorer! In this module, we will learn how to make our data sparkly clean. Imagine you have a big bowl of fruits. Some fruits are rotten, some have dirt, and some are not even fruits! You wouldn't want to eat that, right? In the same way, when we work with data, we must clean it before we use it. Cleaning data means fixing mistakes, removing things we don't need, and making everything neat and tidy. This is a very important job for a data analyst. After this lesson, you will be a Data Cleaning Champion!

๐ŸŽฏ Learning Objectives

  • Understand what data cleaning is and why it matters.
  • Learn how to remove duplicate rows in Power Query.
  • Learn how to fix missing values (blanks).
  • Learn how to split columns into smaller pieces.
  • Learn how to change data types (text, number, date).
  • Learn how to rename columns and headers.
  • Learn how to trim extra spaces from text.
  • Learn how to replace values (change "N/A" to "Not Available").
  • Use the "Remove Rows" and "Keep Rows" tools.
  • Understand how to use the "Fill Down" feature.
  • Combine cleaning steps to make a perfect table.

๐Ÿ“– Warm-up Story: The Messy Market List

Chidi loves helping his mum at the market. One day, his mum gave him a messy list written on a crumpled paper. The list had things like:

milk, MILK, 2 milk, eggs, egg, 5 eggs, bread, bred, butter, buter, jam

Chidi was confused! Some items were repeated, some were spelled wrong, and some had numbers mixed in. He decided to clean the list. He crossed out the repeated "milk", fixed "bred" to "bread", and wrote "butter" correctly. Then he grouped all the eggs together. After cleaning, the list was perfect, and his mum was very happy. That is exactly what we do with data in Power Query โ€“ we clean it so that it makes sense!

๐Ÿ“š Main Lessons (15 Lessons)

Lesson 1: What is Data Cleaning?

Definition: Data cleaning is the process of finding and fixing errors in data.

Why important: Dirty data gives wrong answers. Clean data gives correct answers.

Simple explanation: It's like washing your hands before eating. You remove germs (errors) so you don't get sick (wrong results).

Real-life example: A teacher has a list of students. Some names are spelled wrong. She corrects them. That's cleaning.

School example: Your class register has duplicate names. You remove them.

Home example: You have a list of chores. Some chores are written twice. You delete the extras.

Nigerian example: A shopkeeper in Lagos records sales. Some entries say "N500" and others say "500 Naira". He makes them all "500 Naira".

Illustration:

  Dirty Data          โžก๏ธ   Clean Data
  -----------------        -----------------
  Name:   Tunde           Name:   Tunde
  Age:    25              Age:    25
  City:   Lagos           City:   Lagos
  Name:   Tunde   (dup)   (removed)

Mini summary: Data cleaning fixes mistakes so our data is accurate and useful.

Lesson 2: Removing Duplicate Rows

Definition: Duplicate rows are rows that are exactly the same as another row.

Why important: Duplicates make counts wrong (e.g., counting the same person twice).

Simple explanation: Imagine you have a list of your friends. If "Ade" appears twice, you might think you have two friends named Ade. But it's the same person. So we remove one.

Real-life example: A company sends newsletters. If email addresses are duplicated, people get two emails. They get annoyed.

School example: Your teacher has a list of students who brought books. If a student is listed twice, the count is wrong.

Home example: Your family grocery list has "rice" written three times. You keep only one.

Nigerian example: A bank in Abuja records transactions. The same transaction might be entered twice by mistake. Removing duplicates fixes the balance.

How to do it in Power Query: Select your table, go to the "Home" tab, click "Remove Rows", then "Remove Duplicates".

Illustration:

Before:                   After:
+----+-------+           +----+-------+
| ID | Name  |           | ID | Name  |
+----+-------+           +----+-------+
| 1  | Bola  |           | 1  | Bola  |
| 2  | Tayo  |           | 2  | Tayo  |
| 1  | Bola  |  โ† dup   | 3  | Zain  |
| 3  | Zain  |           +----+-------+
+----+-------+

Mini summary: Use "Remove Duplicates" to delete rows that are identical.

Lesson 3: Fixing Missing Values (Blanks)

Definition: Missing values are empty cells in your data.

Why important: Blanks can cause errors in calculations (e.g., sum of blank is zero, but maybe you wanted to ignore it).

Simple explanation: If a form asks for your age and you leave it blank, the computer doesn't know your age. We can fill it with something like "Unknown" or the average age.

Real-life example: A survey has some questions unanswered. We can fill them with "No answer".

School example: A test score list has a blank for a student who was absent. We can write "Absent".

Home example: A list of birthdays has a missing date. We can write "Not known".

Nigerian example: A hospital in Kano has patient records. Some have no phone number. They fill with "0000".

How to do it: In Power Query, use "Replace Values" to replace null or blank with something else. Or use "Fill Down" to copy the value from above.

Illustration:

Before:           After (Fill Down):
+----+-------+    +----+-------+
| Day| Temp  |    | Day| Temp  |
+----+-------+    +----+-------+
| Mon| 30ยฐ   |    | Mon| 30ยฐ   |
| Tue|       |    | Tue| 30ยฐ   |  โ† copied from Mon
| Wed| 28ยฐ   |    | Wed| 28ยฐ   |
+----+-------+    +----+-------+

Mini summary: Fill blanks with a value or copy from above to avoid empty cells.

Lesson 4: Splitting Columns

Definition: Splitting means dividing one column into two or more columns.

Why important: Sometimes one column has too much information (e.g., "First Name Last Name"). We split it to separate first and last names.

Simple explanation: If you have a jar of mixed sweets, you separate the red ones from the green ones. That's splitting.

Real-life example: A column has "City, State". We split into "City" and "State".

School example: A column has "Subject-Grade" like "Math-A". Split into "Subject" and "Grade".

Home example: A list of "Item-Qty" like "Apples-5". Split into "Item" and "Qty".

Nigerian example: A column has "LGA, State" like "Ikeja, Lagos". Split into "LGA" and "State".

How to do it: Select the column, go to "Transform" tab, click "Split Column", choose "By Delimiter" (like a comma or space).

Illustration:

Before:              After:
+----------------+   +---------+---------+
| Full Name      |   | First   | Last    |
+----------------+   +---------+---------+
| Chidi Okonkwo  |   | Chidi   | Okonkwo |
| Amina Bello    |   | Amina   | Bello   |
+----------------+   +---------+---------+

Mini summary: Split columns to separate data that is combined.

Lesson 5: Changing Data Types

Definition: Data type tells Power Query what kind of data is in a column (text, number, date, etc.).

Why important: If you have numbers stored as text, you cannot add them. So you must change to number type.

Simple explanation: It's like sorting toys: cars go in the car box, dolls in the doll box. You put each data in its correct box.

Real-life example: A column has "1000" but it is text. You change it to number so you can sum it.

School example: "Age" column has numbers but is stored as text. You change to number to calculate average age.

Home example: "Price" column has "โ‚ฆ500" but with a symbol. You remove the symbol and change to number.

Nigerian example: "Date of Birth" is stored as text "12-05-2010". Change to Date type to calculate age.

How to do it: Click the little icon next to the column header (like "ABC" or "123") and choose the correct type (Text, Whole Number, Decimal, Date).

Illustration:

Before (Text)      After (Number)
+-------+          +-------+
| Price |          | Price |
+-------+          +-------+
| 500   |          |  500  |
| 1000  |          | 1000  |
+-------+          +-------+
(Can't sum)        (Can sum = 1500)

Mini summary: Always set the right data type so Power Query can work properly.

Lesson 6: Renaming Columns

Definition: Renaming means changing the name of a column.

Why important: Sometimes column names are not clear (e.g., "Col1"). We rename to something meaningful like "Student Name".

Simple explanation: It's like putting a label on a box so you know what's inside.

Real-life example: A column named "B" actually contains "Age". Rename it to "Age".

School example: "X" column is "Score". Rename to "Math Score".

Home example: "Item" column is actually "Fruit". Rename to "Fruit".

Nigerian example: "Column1" is "State". Rename to "State of Origin".

How to do it: Double-click the column header and type the new name. Or right-click and choose "Rename".

Illustration:

Before:   After:
+------+  +---------+
| Col1 |  | Student |
+------+  +---------+
| Ade  |  | Ade     |
+------+  +---------+

Mini summary: Give columns clear, descriptive names.

Lesson 7: Trimming Extra Spaces

Definition: Trimming removes unwanted spaces at the beginning or end of text.

Why important: " Bola " is not the same as "Bola". Extra spaces can cause problems when you compare or group.

Simple explanation: Imagine writing your name with a big space before it. That looks messy. We erase the space.

Real-life example: A list of cities has " Lagos" and "Lagos". They should be the same. Trim them.

School example: " John " and "John" are different to a computer. Trim to make them match.

Home example: " rice " and "rice" should be the same when searching.

Nigerian example: " Abuja" and "Abuja " are both Abuja after trimming.

How to do it: Select the column, go to "Transform" tab, click "Format", then "Trim".

Illustration:

Before:     After:
"  Bola  "  "Bola"
"Tunde "    "Tunde"
" Amina"    "Amina"

Mini summary: Trim to remove extra spaces and make text clean.

Lesson 8: Replacing Values

Definition: Replacing means changing one value to another (e.g., change "N/A" to "Not Available").

Why important: Standardizes data. For example, "Yes", "Y", "y" all mean the same. We replace them all with "Yes".

Simple explanation: If you have different names for the same thing, you pick one name and use it everywhere.

Real-life example: "Male", "M", "m" all become "Male".

School example: "Absent", "A", "a" all become "Absent".

Home example: "Phone", "tel", "mobile" all become "Phone".

Nigerian example: "Naira", "NGN", "โ‚ฆ" all become "Naira".

How to do it: Right-click the column, choose "Replace Values", enter what to find and what to replace with.

Illustration:

Before:   After:
+-------+ +-------+
| Status| | Status|
+-------+ +-------+
| Y     | | Yes   |
| N     | | No    |
| y     | | Yes   |
+-------+ +-------+

Mini summary: Replace values to make your data uniform.

Lesson 9: Remove Rows (Top, Bottom, Alternate)

Definition: Remove rows means deleting certain rows from your table.

Why important: Sometimes you only need a portion of data (e.g., first 10 rows for a sample).

Simple explanation: If you have a long queue, you might only talk to the first 5 people.

Real-life example: You have 1000 rows but only want top 100 for testing.

School example: You have a list of 50 students but only need top 5.

Home example: You have a list of 20 groceries but only want the first 3 for a quick check.

Nigerian example: A store in Ibadan has 200 sales records but only wants the latest 10.

How to do it: Home tab โ†’ Remove Rows โ†’ Remove Top Rows, Remove Bottom Rows, or Remove Alternate Rows.

Illustration:

Before (10 rows)    After Remove Top 3 (7 rows left)
+----+-----+        +----+-----+
| 1  | A   |        | 4  | D   |
| 2  | B   |  โ† remove | 5  | E   |
| 3  | C   |  โ† remove | 6  | F   |
| 4  | D   |        | 7  | G   |
| 5  | E   |        | 8  | H   |
...                 ...
+----+-----+        +----+-----+

Mini summary: Remove rows you don't need to focus on important data.

Lesson 10: Keep Rows (Top, Bottom, Range)

Definition: Keep rows means you select and keep only certain rows, deleting all others.

Why important: This is the opposite of remove rows. You choose what to keep.

Simple explanation: It's like picking only the red marbles from a bag and leaving the rest.

Real-life example: You have sales data for all months but only want January to March.

School example: You have grades for all subjects but only want Science grades.

Home example: You have a list of all bills but only want electricity bills.

Nigerian example: You have data for all states but only want Lagos and Abuja.

How to do it: Home tab โ†’ Keep Rows โ†’ Keep Top Rows, Keep Bottom Rows, Keep Range of Rows.

Illustration:

Before (10 rows)    After Keep Top 2 (only 2 rows)
+----+-----+        +----+-----+
| 1  | A   |  โ† keep | 1  | A   |
| 2  | B   |  โ† keep | 2  | B   |
| 3  | C   |  remove |    |     |
| 4  | D   |  remove |    |     |
...                 ...
+----+-----+        +----+-----+

Mini summary: Keep only the rows that matter to you.

Lesson 11: Fill Down (Copy from above)

Definition: Fill Down copies the value from the cell above to the empty cells below.

Why important: Useful when you have a header that applies to multiple rows (e.g., a category).

Simple explanation: If you have a list of fruits, and "Apple" is written once, you can fill down so all apples have that label.

Real-life example: A sales table where the region is only written in the first row of each region. Fill down to fill all rows.

School example: A class list where the teacher's name is only in the first row. Fill down for all students.

Home example: A chore list where the day is written once. Fill down for all chores on that day.

Nigerian example: A table of LGA's, only the state is written once. Fill down to show state for every LGA.

How to do it: Select the column, go to "Transform" tab, click "Fill" and choose "Down".

Illustration: (See Lesson 3 illustration).

Mini summary: Fill Down copies the upper value to lower empty cells.

Lesson 12: Fill Up (Copy from below)

Definition: Fill Up copies the value from the cell below to the empty cells above.

Why important: Less common but useful when the first row is blank and the data starts later.

Simple explanation: Same as Fill Down but going upwards.

Real-life example: A table where the header is at the bottom. Fill up to move it to the top.

School example: A list where the last row has the correct value for all above.

Home example: A shopping list where the total is at the bottom, fill up to give each item the total.

Nigerian example: A report where the summary is at the bottom, fill up to apply to all.

How to do it: Transform tab โ†’ Fill โ†’ Up.

Illustration:

Before:      After Fill Up:
+-------+    +-------+
|       |    |  50   |  โ† copied from below
|       |    |  50   |
|  50   |    |  50   |
+-------+    +-------+

Mini summary: Fill Up copies the lower value to upper empty cells.

Lesson 13: Combine Cleaning Steps

Definition: This means doing many cleaning actions one after another.

Why important: Real data needs many fixes. You combine them to get a perfect table.

Simple explanation: It's like a recipe: first wash the vegetables, then chop them, then cook them.

Real-life example: A data set: remove duplicates, trim spaces, change types, rename columns.

School example: A grade sheet: remove missing, change text to numbers, sort.

Home example: A budget: replace categories, split amounts, fill missing.

Nigerian example: A COVID-19 data: remove duplicate entries, fix date format, replace missing with "0".

How to do it: In Power Query, each step appears in the "Applied Steps" pane. You can reorder or delete steps.

Illustration: (Flow chart)

   Start
    |
    V
 Remove Duplicates
    |
    V
 Trim Spaces
    |
    V
 Change Data Types
    |
    V
 Rename Columns
    |
    V
   Done

Mini summary: Combine steps to clean data thoroughly.

Lesson 14: Using "Replace Errors"

Definition: Replace Errors changes error values (like #Error) to something else.

Why important: Errors stop calculations. Replacing them with 0 or "Unknown" lets you continue.

Simple explanation: If a math sum gives an error, you can say "let's treat it as zero".

Real-life example: A column has "5/0" which gives error. Replace with 0.

School example: A formula column has errors. Replace with "N/A".

Home example: A budget column has errors. Replace with 0.

Nigerian example: A financial report has division by zero errors. Replace with 0.

How to do it: Right-click the column โ†’ Replace Errors โ†’ type the replacement value.

Illustration:

Before:   After:
+-------+ +-------+
| #Error| |   0   |
| 10    | |  10   |
+-------+ +-------+

Mini summary: Replace errors to avoid breaking your analysis.

Lesson 15: Pivot and Unpivot (advanced but fun)

Definition: Pivot turns rows into columns. Unpivot turns columns into rows.

Why important: Sometimes data is in a "wide" format, but you need "long" format for analysis.

Simple explanation: If you have a table with months as columns, unpivot makes a "Month" column and a "Value" column.

Real-life example: Sales data with Jan, Feb, Mar as columns. Unpivot to have Month and Sales rows.

School example: A table with subjects as columns. Unpivot to have Subject and Score rows.

Home example: A budget with months as columns. Unpivot for easier charting.

Nigerian example: A table with states as columns. Unpivot to have State and Population rows.

How to do it: Select columns, right-click โ†’ Unpivot Columns. Or Pivot on a column.

Illustration:

Wide (Pivot)              Long (Unpivot)
+----+-----+-----+       +----+-------+-------+
|Year| Jan | Feb |       |Year| Month | Sales |
+----+-----+-----+       +----+-------+-------+
|2024| 100 | 150 |  โžก๏ธ  |2024| Jan   | 100   |
+----+-----+-----+       |2024| Feb   | 150   |
                          +----+-------+-------+

Mini summary: Pivot/Unpivot reshapes your data for different needs.

๐Ÿ“– Key Vocabulary (with simple definitions)

  • Data Cleaning: Fixing mistakes in data.
  • Duplicate: Two or more identical rows.
  • Missing Value: An empty cell.
  • Split: Divide one column into two.
  • Data Type: The kind of data (text, number, date).
  • Trim: Remove extra spaces.
  • Replace: Change one value to another.
  • Fill Down: Copy value from above.
  • Pivot: Turn rows into columns.
  • Unpivot: Turn columns into rows.

๐Ÿง  Important Concepts

  • Garbage in, garbage out: If your data is dirty, your results will be wrong. Clean data leads to correct answers.
  • Step-by-step: Power Query records every cleaning step. You can go back and change any step.
  • Always check data types: A number stored as text cannot be added. Always set the right type.
  • Standardize: Make everything uniform (e.g., all dates in the same format).

๐Ÿ”ข Step-by-Step Explanations

How to remove duplicates:

  1. Select the table.
  2. Go to Home tab.
  3. Click "Remove Rows".
  4. Choose "Remove Duplicates".
  5. Done! All exact duplicate rows are deleted.

How to split a column by delimiter:

  1. Select the column (e.g., "Full Name").
  2. Go to Transform tab.
  3. Click "Split Column".
  4. Choose "By Delimiter".
  5. Select space or comma.
  6. Click OK. Now you have two columns.

๐ŸŒ Real-life Examples

  • Banking: Banks clean transaction data to find fraud.
  • Healthcare: Hospitals clean patient records to avoid mistakes.
  • Retail: Stores clean sales data to know what sells best.

๐Ÿ‡ณ๐Ÿ‡ฌ Nigerian Examples

  • NIN Registration: The National Identity Management Commission cleans NIN data to avoid duplicates.
  • Election Results: INEC cleans voter data to ensure accuracy.
  • Market Sales: A trader in Onitsha cleans sales records to know profits.

๐ŸŽˆ Fun Examples Children Can Relate To

  • Toys: Cleaning a list of toys: remove duplicates, fix spellings (e.g., "car" and "kar").
  • Candy: A list of candies with different names for same candy. Replace them all with one name.
  • Friends: A list of friends with extra spaces in names. Trim to make neat.

๐Ÿ  Everyday Examples

  • Phone contacts: Cleaning contacts: remove duplicates, fix names.
  • Recipe book: Clean ingredients list: remove duplicates, correct measurements.
  • Homework list: Clean the list of assignments: remove completed ones, add due dates.

๐Ÿ‘ฉโ€๐Ÿซ Teacher Notes

  • Encourage students to practice with real messy data (e.g., a list of names with typos).
  • Use group activities where each group cleans a different dataset.
  • Emphasize that cleaning is often the most time-consuming but most important step.

๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘ฆ Parent Tips

  • Help your child find messy data at home (e.g., a handwritten grocery list).
  • Discuss why clean data is important (e.g., correct change at the store).
  • Encourage them to use Power Query to clean data for school projects.

๐Ÿ’ก Interesting Facts

  • Data scientists spend about 80% of their time cleaning data!
  • Power Query was originally an Excel add-in, now it's built into Excel and Power BI.
  • Cleaning data can save companies millions of dollars by avoiding errors.

โ“ Did You Know?

Did you know that the word "data" comes from Latin, meaning "given" (like a gift). But dirty data is not a gift โ€“ it's a headache! So we clean it.

๐Ÿ”” Remember This

  • Always clean your data before analyzing.
  • Power Query records all steps, so you can undo or redo.
  • Check for duplicates, blanks, and wrong data types.

โš ๏ธ Common Mistakes

  • Forgetting to trim spaces โ€“ "Ade" and "Ade " are different.
  • Not changing data type โ€“ trying to sum text.
  • Removing rows without checking if they are needed.
  • Not replacing errors โ€“ leaving #Error in data.

โœ… Best Practices

  • Always make a copy of your original data before cleaning.
  • Use descriptive column names.
  • Apply cleaning steps in a logical order (e.g., remove duplicates first, then trim).
  • Check data types after each transformation.

๐Ÿ“Š ASCII Illustrations

Data Cleaning Process Flowchart

   Start
    |
    V
 Load Data
    |
    V
 Remove Duplicates
    |
    V
 Replace Missing Values
    |
    V
 Split Columns (if needed)
    |
    V
 Change Data Types
    |
    V
 Trim Spaces
    |
    V
 Rename Columns
    |
    V
   Done ๐ŸŽ‰

Comparison: Dirty vs Clean Data

+----------------------------+  +----------------------------+
|      Dirty Data            |  |      Clean Data            |
+----------------------------+  +----------------------------+
| Name: "  Ade "             |  | Name: "Ade"                |
| Age: "25" (text)           |  | Age: 25 (number)           |
| City: "Lagos, Nigeria"     |  | City: "Lagos"              |
|                            |  | Country: "Nigeria"         |
| Duplicate row of Ade       |  | (Duplicate removed)        |
+----------------------------+  +----------------------------+

๐Ÿ“‹ Comparison Tables

Remove Rows vs Keep Rows

FeatureRemove RowsKeep Rows
What it doesDeletes selected rowsKeeps selected rows, deletes others
Use whenYou want to exclude dataYou want to focus on specific data
ExampleRemove top 5 rowsKeep top 5 rows

Fill Down vs Fill Up

FeatureFill DownFill Up
DirectionCopies from above to belowCopies from below to above
Use whenHeader is at the topHeader is at the bottom
CommonVery commonLess common

๐Ÿ“ End-of-Module Summary

Well done! You have completed Module Seven on Data Cleaning. You learned:

  • What data cleaning is and why it's important.
  • How to remove duplicates, fix missing values, and split columns.
  • How to change data types, rename columns, and trim spaces.
  • How to replace values, remove or keep rows, and fill down/up.
  • How to combine steps and handle errors.
  • How to pivot and unpivot data.

Cleaning data is like being a detective โ€“ you find clues (errors) and fix them. Now you are ready to clean any messy data!

โ“ Frequently Asked Questions (10)

  1. Why do we need to clean data? โ€“ To get correct answers and avoid mistakes.
  2. What is a duplicate row? โ€“ A row that is exactly the same as another row.
  3. How do I remove duplicates in Power Query? โ€“ Home tab โ†’ Remove Rows โ†’ Remove Duplicates.
  4. What does "trim" do? โ€“ Removes extra spaces from text.
  5. What is a data type? โ€“ It tells Power Query if data is text, number, date, etc.
  6. Why can't I sum numbers that are text? โ€“ Because text cannot be added. Change to number type.
  7. What is "Fill Down"? โ€“ Copies the value from the cell above to empty cells below.
  8. What is "Replace Values"? โ€“ Changes one value to another (e.g., "N/A" to "Not Available").
  9. What does "Split Column" do? โ€“ Divides one column into two or more columns.
  10. Can I undo a cleaning step? โ€“ Yes, Power Query records all steps, so you can delete or reorder them.

๐Ÿ“ Review Questions (15)

  1. What is data cleaning?
  2. Why are duplicates bad?
  3. How do you remove duplicates?
  4. What is a missing value?
  5. How do you fix missing values?
  6. What does splitting a column do?
  7. Give an example of splitting a column.
  8. What is a data type?
  9. Why should you change data types?
  10. What does trimming do?
  11. What is "Replace Values" used for?
  12. What is the difference between "Remove Rows" and "Keep Rows"?
  13. When would you use "Fill Down"?
  14. What is the purpose of "Replace Errors"?
  15. Name three cleaning steps you learned.

โœ๏ธ Fill-in-the-Blank Exercises

  1. Data cleaning is the process of finding and fixing ______ in data.
  2. ______ rows are rows that are exactly the same.
  3. ______ removes extra spaces from text.
  4. Changing a column from text to number is changing the ______.
  5. ______ copies the value from the cell above to empty cells below.

โœ… True or False Exercises

  1. Data cleaning is not important. (False)
  2. Duplicates are good for analysis. (False)
  3. Trimming removes extra spaces. (True)
  4. You cannot change data types in Power Query. (False)
  5. Fill Down copies from below. (False โ€“ it copies from above)

๐Ÿ”˜ Multiple Choice Questions (15 with answers)

  1. Which tool removes exact duplicate rows?
    a) Trim b) Remove Duplicates c) Split d) Fill Down
    Answer: b
  2. What does "Trim" do?
    a) Adds spaces b) Removes extra spaces c) Removes duplicates d) Splits columns
    Answer: b
  3. Which data type is used for numbers?
    a) Text b) Date c) Number d) Logical
    Answer: c
  4. What does "Split Column" do?
    a) Combines columns b) Divides one column into two c) Deletes a column d) Renames a column
    Answer: b
  5. What is a missing value?
    a) A value that is too high b) A value that is too low c) An empty cell d) A duplicate
    Answer: c
  6. Which function copies a value from above?
    a) Fill Up b) Fill Down c) Trim d) Split
    Answer: b
  7. Which function changes "N/A" to "Not Available"?
    a) Trim b) Replace Values c) Remove Duplicates d) Split
    Answer: b
  8. What is the first step in data cleaning?
    a) Load data b) Remove duplicates c) Trim d) Split
    Answer: a (load data first)
  9. Which option keeps only the first 5 rows?
    a) Remove Top Rows b) Keep Top Rows c) Remove Duplicates d) Fill Down
    Answer: b
  10. Which option deletes the first 5 rows?
    a) Remove Top Rows b) Keep Top Rows c) Remove Duplicates d) Fill Down
    Answer: a
  11. What does Pivot do?
    a) Turns rows into columns b) Turns columns into rows c) Removes duplicates d) Trims spaces
    Answer: a
  12. What does Unpivot do?
    a) Turns rows into columns b) Turns columns into rows c) Removes duplicates d) Trims spaces
    Answer: b
  13. Which is NOT a data type?
    a) Text b) Number c) Color d) Date
    Answer: c
  14. What is the purpose of "Replace Errors"?
    a) Remove duplicates b) Change error values to something else c) Split columns d) Fill down
    Answer: b
  15. How can you rename a column?
    a) Double-click header b) Remove duplicates c) Split d) Trim
    Answer: a

๐Ÿ”— Matching Exercises

Match the term to its definition:

TermDefinition
1. TrimA. Copy value from above
2. Fill DownB. Remove extra spaces
3. DuplicateC. Divide one column into two
4. SplitD. Identical row
5. Data TypeE. Kind of data (text, number, date)

Answers: 1-B, 2-A, 3-D, 4-C, 5-E

โœ๏ธ Short Answer Questions

  1. Explain why cleaning data is important.
  2. Describe three ways to clean data.
  3. What is the difference between "Remove Rows" and "Keep Rows"?
  4. Give an example of a data type conversion.
  5. Why do we use "Replace Values"?

๐Ÿ“– Scenario-based Exercises

Scenario 1: You have a list of students with names, ages, and grades. Some ages are blank, some names have extra spaces, and there are duplicate rows for a student. What steps would you take to clean this data?

Scenario 2: A store in Lagos has sales data with columns: "Product", "Price (โ‚ฆ)", "Date". The "Price" column has "โ‚ฆ" symbols and spaces. How would you clean this data to calculate total sales?

๐Ÿ‘ฅ Group Activity

In groups of 3, download a sample dataset with messy data (or create one). Assign each person a cleaning task: one removes duplicates, one trims and replaces, one changes data types. Then combine the cleaned data.

๐Ÿง‘โ€๐ŸŽ“ Individual Activity

Take a messy list of 20 names (some with spaces, duplicates, typos). Use Power Query to clean it: trim, remove duplicates, fix typos, and rename the column. Write down the steps you took.

๐Ÿ’ฌ Classroom Discussion Questions

  • Why do you think data cleaning is often called "data wrangling"?
  • What happens if we skip data cleaning?
  • Can you think of a time when you had to clean something (not data)? How is it similar?

๐Ÿ› ๏ธ Mini Project

Project: Clean a School Dataset

You are given a dataset of 100 students with columns: StudentID, Name, Class, Score. The dataset has duplicates, missing scores, and inconsistent names (some have extra spaces, some are in uppercase/lowercase). Clean the dataset using Power Query. Present the cleaned table in class.

๐Ÿ“‹ Practical Assignment

Download a CSV file from the internet (e.g., a sample sales dataset). Use Power Query to:

  1. Remove duplicates.
  2. Trim all text columns.
  3. Change data types correctly.
  4. Split any combined columns.
  5. Replace missing values with "0" or "Unknown".
  6. Save the cleaned data as a new CSV.

๐Ÿ† Challenge Exercise

You have a dataset with sales for 5 years, each year as a separate column (2019, 2020, 2021, 2022, 2023). Unpivot this data to create a "Year" column and a "Sales" column. Then clean the data: remove any rows with sales less than 0, and replace any missing years with the average of the previous and next year.

๐Ÿ“ Quiz Answers

Fill-in-the-Blank: 1. errors, 2. Duplicate, 3. Trim, 4. data type, 5. Fill Down

True/False: 1-F, 2-F, 3-T, 4-F, 5-F

Matching: 1-B, 2-A, 3-D, 4-C, 5-E

๐Ÿ”‘ Key Takeaways

  • Data cleaning is essential for accurate analysis.
  • Power Query provides many tools to clean data easily.
  • Always check for duplicates, blanks, and incorrect data types.
  • Combining cleaning steps creates a powerful data transformation.
  • Practice makes perfect โ€“ clean different datasets to become an expert.

๐Ÿ“– Preparation for the Next Module

In Module Eight, we will learn about Combining Data โ€“ how to merge and append tables. We will join data from different sources, just like putting puzzle pieces together. Get ready to become a Data Merger!

Before the next class, practice cleaning at least three different datasets. The more you clean, the better you become.


ยฉ 2025 Certified Power Query for Data Analysis Expert โ€“ Module Seven

๐Ÿ† Get Certified

๐Ÿ”’

Earn this certificate

Every lesson is already free to read. Sign up, finish the lessons, pass the exam (โ‚ฆ2,000 or 20,000 coins), and get a verified certificate with your name on it.

๐ŸŽ“ Sign Up to Get Certified
๐Ÿ› ๏ธ Practice Tools
Hands-on simulators & labs - subscription required.
โ†’
๐ŸŽฏ Internship Tasks
Real-world tasks to build your portfolio - unlock them with a subscription.
โ†’