Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
← Power Query for Data Analysis · Lesson 5 of 17

Module Four

📖 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.
5
Module 4 · Power Query for Data Analysis Expert

📘 Module Four: Clean, Combine & Conquer – The Art of Shaping Data

Welcome, young data explorer! In this module, we will learn how to take messy, mixed‑up data and turn it into neat, tidy tables – just like arranging your toys in the right boxes. We call this “data cleaning” and “data shaping”. Power Query is like a magic kitchen where we chop, mix, and cook raw ingredients (data) into a delicious meal (clean information). By the end of this chapter, you will be able to fix errors, split names, join tables, and make your data ready for answers.

🎯 Learning Objectives

  • Explain why data must be cleaned before analysis.
  • Use Power Query to remove empty rows and fix spelling mistakes.
  • Split one column into two (like separating first name and last name).
  • Merge two tables together using a common column.
  • Change data types (text, number, date) correctly.
  • Use the “Fill Down” feature to copy values.
  • Create custom columns with simple formulas.

📖 Warm‑up Story: Grandma’s Spice Mix

Ade loves helping his grandma in the kitchen. One day, Grandma said, “Ade, please mix the spices for the jollof rice – but each spice is in a different bag, and some bags are not labelled!” Ade found bags with “salt”, “pepper”, “curry”, and one bag just said “????”. He had to sort, taste, and mix everything carefully. When he finished, the jollof rice was perfect!
Data is like those spices. It comes from different places, sometimes with missing labels. Power Query is your mixing bowl – it helps you sort, rename, and blend everything so you can cook up the right answers!

📚 Main Lessons

Lesson 1: What is “Data Cleaning”?

Definition: Data cleaning means fixing mistakes and removing things that don’t belong in your data table.

Why important: If your data is dirty, your answers will be wrong – like using salt instead of sugar in a cake!

Simple explanation: Imagine your school’s list of students has some names spelled wrong and some blank rows. Cleaning means you correct the names and delete the empty rows.

Real‑life example: A shopkeeper checks his sales list – some prices are missing, so he fills them in.

School example: The class register has two “Mary” entries – one is Mary A., the other Mary B. You fix it.

Home example: Your mom’s grocery list has “milk” written twice – you cross out the extra one.

Nigerian example: A local market seller records sales on paper. Some numbers are faded; she rewrites them clearly before typing into Excel.

Dirty data   →   Clean data
"2,0"        →   20
"N/A"        →   (empty)
"LAGOS"      →   "Lagos"

Mini summary: Cleaning = fixing errors and removing clutter so your data tells the truth.

Lesson 2: Removing Empty Rows and Columns

Definition: Empty rows are blank lines in your table. Empty columns have no data at all.

Why important: They waste space and can confuse Power Query.

Simple explanation: Like having empty chairs in a classroom – you don’t count them when taking attendance.

Real‑life example: A phone book with blank pages – you skip them.

School example: Your teacher’s mark sheet has empty rows for absent students – she removes them.

Home example: A list of chores with a blank line – you delete it.

Nigerian example: A Lagos bus conductor’s daily passenger count may have blank rows for trips that didn’t happen; he removes them.

How to in Power Query: Home → Remove Rows → Remove Blank Rows.

Before:
Row1: Ade, 10
Row2: (blank)
Row3: Bola, 12

After:
Row1: Ade, 10
Row2: Bola, 12

Mini summary: Blank rows are like empty seats – take them out!

Lesson 3: Fixing Spelling and Capital Letters

Definition: This means making sure all names and words are spelled the same way and have proper capital letters.

Why important: “LAGOS” and “lagos” are the same city – but the computer thinks they are different if we don’t fix them.

Simple explanation: Like writing your name with a capital letter – “Ade” not “ade”.

School example: Your class list has “John” and “jon” – you change both to “John”.

Home example: Your dad’s contact list has “Mum” and “mum” – you make them both “Mum”.

Nigerian example: Abuja is sometimes written “abuja” – we change it to “Abuja”.

Before: "ikeja", "IKEJA", "Ikeja"
After:  "Ikeja", "Ikeja", "Ikeja"

Mini summary: Always use the same spelling and capitals so your data stays neat.

Lesson 4: Splitting Columns

Definition: Splitting means taking one column and dividing it into two columns – like separating first name and last name.

Why important: It helps you sort by last name or first name separately.

Simple explanation: Like separating your full name “Ade Ojo” into “Ade” and “Ojo”.

Real‑life example: A list of customers has “Mr. Ade Ojo” – you split into title, first name, last name.

School example: The teacher has “Maryam Bello” – split into “Maryam” and “Bello”.

Home example: “Chicken and rice” – split into “Chicken” and “rice”.

Nigerian example: “Lagos, Nigeria” – split into “Lagos” and “Nigeria”.

How to: Transform → Split Column → By Delimiter (e.g., space or comma).

FullName       →   FirstName   LastName
Ade Ojo        →   Ade         Ojo
Funke Ade      →   Funke       Ade

Mini summary: Split separates data into smaller pieces for better handling.

Lesson 5: Merging Columns

Definition: Merging is the opposite of splitting – you combine two columns into one.

Why important: Sometimes you want a full name instead of separate first and last.

Simple explanation: Like putting two puzzle pieces together to see the whole picture.

School example: You have “First” and “Last” – merge to “Full Name”.

Home example: “Street” and “City” merge to “Address”.

Nigerian example: “State” and “LGA” merge to “Location”.

First   Last   →   FullName
Ade     Ojo    →   Ade Ojo

Mini summary: Merging puts pieces back together when needed.

Lesson 6: Changing Data Types (Text, Number, Date)

Definition: Data type tells Power Query what kind of data is in a column – words (text), numbers, or dates.

Why important: You can’t add text like “ten” to a number – the computer needs to know.

Simple explanation: Like sorting toys into boxes – words in one box, numbers in another.

Real‑life example: “1,000” as text vs. 1000 as a number – you can only add numbers.

School example: Marks are numbers, names are text – don’t mix them.

Home example: Date of birth is a date; age is a number.

Nigerian example: “₦500” is text (has symbol) but we need the number 500 to add prices.

Text: "10"  →  Number: 10
Date: "01/01/2025" → Date type

Mini summary: Always set the right data type so Power Query understands your data.

Lesson 7: Fill Down – Copying Values Down

Definition: Fill Down takes a value from a cell and copies it into the empty cells below it.

Why important: In some tables, the value is only written once, but it applies to many rows.

Simple explanation: Like when your teacher says “Class 4” at the top – it means all students are in Class 4.

School example: A register with “Year 5” at the top – fill down so every row has “Year 5”.

Home example: A grocery list with “Store: Shoprite” at the top – fill down for all items.

Nigerian example: A list of students from “Lagos State” – fill down so all rows show Lagos.

Before:           After:
Region            Region
North             North
(blank)           North
South             South
(blank)           South

Mini summary: Fill Down saves time – copy once, paste many!

Lesson 8: Creating Custom Columns

Definition: A custom column is a new column you build using a formula, like combining or calculating.

Why important: It lets you create new information from existing columns.

Simple explanation: Like making a fruit salad – you take apples and oranges and mix them into a new dish.

School example: You have “Maths” and “English” marks – create a “Total” column by adding them.

Home example: You have “Price” and “Quantity” – create “Total Cost” = Price × Quantity.

Nigerian example: You have “Naira” and “Kobo” – create “Total Amount” in Naira.

Price   Quantity   →   TotalCost
100     3          →   300
200     2          →   400

Mini summary: Custom columns let you create new facts from your data.

Lesson 9: Merging Tables (Like Joining Friends)

Definition: Merging tables means bringing two tables together based on a common column (like a student ID).

Why important: Sometimes information about the same thing is in two places – merging brings it together.

Simple explanation: Like having your friends’ names in one list and their phone numbers in another – you combine them.

School example: Table 1: Student ID and Name. Table 2: Student ID and Marks. Merge to get Name + Marks.

Home example: Table 1: Item names. Table 2: Prices. Merge to see item + price.

Nigerian example: Table 1: LGA names. Table 2: LGA population. Merge to get LGA + population.

Table1 (ID, Name)   +   Table2 (ID, Age)  →  Merged (ID, Name, Age)
1, Ade                   1, 10             →  1, Ade, 10
2, Bola                  2, 12             →  2, Bola, 12

Mini summary: Merging joins two tables using a shared key column.

Lesson 10: Pivot and Unpivot – Changing Table Shape

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

Why important: Sometimes data is easier to read in a different shape.

Simple explanation: Like turning a line of people into a circle – same people, different arrangement.

School example: You have subjects as columns – pivot to make subjects rows.

Home example: You have months as columns – pivot to make months rows for easier charting.

Nigerian example: Sales data with months as columns – pivot to analyse by month.

Before (wide):
Student  Maths  English
Ade      80     70
After (long):
Student  Subject  Marks
Ade      Maths    80
Ade      English  70

Mini summary: Pivot and unpivot change how your table looks, not the data itself.

Lesson 11: Replacing Values

Definition: Replacing means swapping one value with another – like changing “N/A” to blank.

Why important: It standardises data so everything is consistent.

Simple explanation: Like changing “Mum” to “Mother” everywhere.

School example: Replace “Abs” with “Absent”.

Home example: Replace “fridge” with “refrigerator”.

Nigerian example: Replace “LAG” with “Lagos”.

Before: "LAG", "Lagos", "lagos"
After:  "Lagos", "Lagos", "Lagos"

Mini summary: Replace fixes inconsistent words quickly.

Lesson 12: Keeping Only Important Columns

Definition: You can choose to remove columns you don’t need.

Why important: Fewer columns make it easier to focus on what matters.

Simple explanation: Like choosing only your favourite toys to play with.

School example: A report card has many columns – keep only Name and Total.

Home example: Shopping list with price, quantity, and aisle – keep only price and quantity.

Nigerian example: Population data with many details – keep only State and Population.

Before: ID, Name, Age, Grade, Teacher
After:  Name, Grade   (removed ID, Age, Teacher)

Mini summary: Keep only the columns that answer your question.

Lesson 13: Sorting and Filtering Rows

Definition: Sorting arranges rows in order (A→Z, smallest→largest). Filtering shows only rows that meet a condition.

Why important: It helps you find the top scores or see only a specific group.

Simple explanation: Like lining up from shortest to tallest (sorting) or only picking kids who wear glasses (filtering).

School example: Sort marks from highest to lowest; filter to see only students with marks above 80.

Home example: Sort grocery list alphabetically; filter to show only fruits.

Nigerian example: Sort states by population; filter to show only states in the South‑South.

Sort: 5, 3, 9 → 3, 5, 9
Filter: [10, 20, 30] > 20 → [30]

Mini summary: Sorting and filtering help you find the data you need quickly.

Lesson 14: Using the “Group By” Feature

Definition: Group By takes rows with the same value and summarises them – like counting or summing.

Why important: It gives you totals by category – like total sales per region.

Simple explanation: Like grouping your toys by colour and counting how many of each colour.

School example: Group students by class and count how many in each class.

Home example: Group shopping items by category (fruits, vegetables) and count.

Nigerian example: Group sales by state and find total sales per state.

Before: (Ade, Lagos), (Bola, Lagos), (Tunde, Abuja)
After Group By State:
Lagos: 2
Abuja: 1

Mini summary: Group By summarises data by categories.

Lesson 15: Undo and Redo – Fixing Mistakes

Definition: Undo takes back your last step. Redo puts it back again.

Why important: You can experiment without fear – if you make a mistake, just undo!

Simple explanation: Like erasing a wrong answer and writing it again.

School example: You delete a column by mistake – undo brings it back.

Home example: You change “rice” to “beans” – undo changes it back.

Nigerian example: You replaced all “Lagos” with “Abuja” – undo to fix.

How to: Use the “Undo” button or Ctrl+Z.

Mini summary: Undo is your safety net – always available!

🔑 Key Vocabulary (simple definitions)

  • Data cleaning: Fixing errors and removing useless parts in data.
  • Column: A vertical list of values (like a column in a building).
  • Row: A horizontal line of data (like a row of seats).
  • Delimiter: A symbol that separates pieces, like a space or comma.
  • Merge: To combine two tables into one.
  • Pivot: Turning rows into columns.
  • Unpivot: Turning columns into rows.
  • Data type: Tells the computer if data is text, number, or date.
  • Fill Down: Copies a value from above to empty cells below.
  • Group By: Summarises rows that share a common value.

🧠 Important Concepts

  • Garbage in, garbage out: If you put dirty data in, you get wrong answers out.
  • Consistency: Always use the same spelling and format.
  • Data integrity: Keeping data accurate and reliable.
  • Normalisation: Organising data to avoid duplication.

📝 Step‑by‑Step Explanations

How to Split a Column

  1. Select the column you want to split.
  2. Click “Transform” → “Split Column” → “By Delimiter”.
  3. Choose the delimiter (e.g., space, comma).
  4. Choose where to split (leftmost, rightmost, or all).
  5. Click OK – now you have two columns!

How to Merge Two Tables

  1. Click “Home” → “Merge Queries”.
  2. Select the second table.
  3. Choose the common column (like Student ID) in both tables.
  4. Select join type (usually “Left Outer” to keep all from the first table).
  5. Click OK – then expand the new column to bring in the fields.

🌍 Real‑life Examples

  • Bank: Banks clean customer data to send the right messages.
  • Hospital: Doctors clean patient records to avoid medicine errors.
  • Supermarket: Cleans sales data to know which products sell most.

🇳🇬 Nigerian Examples

  • INEC voter list: Clean names and addresses to avoid duplicates.
  • Nigerian Census: Combine state and LGA data for population counts.
  • Market traders: Merge daily sales from different stalls.

🧸 Fun Examples

  • Your collection of 100 toy cars – clean by removing broken ones.
  • Your friend list – merge with birthdays to know whom to wish.
  • Your Pokémon cards – group by type (fire, water).

🏠 Everyday Examples

  • Cleaning your school bag by removing old papers.
  • Sorting your books by subject.
  • Combining two lists of chores into one.

👩‍🏫 Teacher Notes

  • Encourage students to practice each operation on sample data.
  • Use real school data (like marks) to make it relevant.
  • Emphasise that mistakes are part of learning – use undo.

👨‍👩‍👧 Parent Tips

  • Help your child create a simple data table (e.g., weekly allowance).
  • Show them how to correct spelling errors in a list.
  • Make it a game – “find and fix” the dirty data!

💡 Interesting Facts

  • Data scientists spend up to 80% of their time cleaning data!
  • Power Query can clean millions of rows in seconds.
  • Clean data helps predict traffic, weather, and even disease spread.

🤔 Did You Know?

  • Power Query was originally called “Data Explorer”.
  • You can connect Power Query to websites and clean live data.

🧷 Remember This

  • Always clean your data before analysing.
  • Check data types – text, number, date.
  • Use split and merge when needed.
  • Group By gives you summaries.

⚠️ Common Mistakes

  • Forgetting to change data type – adding text as numbers.
  • Not removing blank rows – they affect totals.
  • Merging tables without a matching column.
  • Using the wrong delimiter when splitting.

✅ Best Practices

  • Always keep a copy of the original data.
  • Name your steps clearly in Power Query.
  • Use “Remove Duplicates” to keep only unique rows.
  • Preview your data after every step.

🖼️ Illustrations

Data Cleaning Process
+-------------------+
|  Dirty Data       |
|  (spelling errors,|
|   blanks, mixed)  |
+--------+----------+
         |
         V
+--------+----------+
|  Clean Steps      |
|  - Remove blanks  |
|  - Fix spelling   |
|  - Split columns  |
+--------+----------+
         |
         V
+--------+----------+
|  Clean Data       |
|  (neat, correct,  |
|   ready to use)   |
+-------------------+
Split Column – before and after
+-----------------+     +-----------------+-----------------+
| FullName        |     | FirstName       | LastName        |
+-----------------+     +-----------------+-----------------+
| Ade Ojo         |  →  | Ade             | Ojo             |
+-----------------+     +-----------------+-----------------+

📊 Comparison Tables

OperationUseExample
SplitSeparate one column into twoFullName → First, Last
MergeCombine two columns into oneFirst + Last → FullName
Group BySummarise by categoryCount students per class
PivotRows to columnsSubject names as columns

📌 End‑of‑Module Summary

In this module, we learned how to make our data beautiful and useful. We removed blank rows, fixed spelling, split and merged columns, changed data types, used Fill Down, created custom columns, and even merged tables. We also explored Pivot, Unpivot, Group By, and sorting. Remember – clean data leads to correct answers. Always check your data types and keep only what you need. You are now ready to turn messy data into a clear story!

❓ Frequently Asked Questions

  1. What is the first step in cleaning data? – Look for blank rows and remove them.
  2. How do I split a column? – Use “Split Column” by delimiter like space.
  3. What is a delimiter? – A symbol that separates parts, e.g., comma, space.
  4. Why change data types? – So Power Query knows if it’s text, number, or date.
  5. What does Fill Down do? – Copies a value from above to empty cells below.
  6. How do I merge two tables? – Use “Merge Queries” and choose a common column.
  7. What is Group By? – Summarises rows with the same value (e.g., count by state).
  8. Can I undo a step? – Yes, click Undo or press Ctrl+Z.
  9. What is Pivot? – Turns rows into columns.
  10. What is the most important rule? – Always clean your data before analysing!

📝 Review Questions

  1. What does data cleaning mean?
  2. How do you remove blank rows in Power Query?
  3. Why is it important to fix capital letters?
  4. Name two ways to split a column.
  5. What is the difference between merge and split?
  6. List three data types.
  7. When would you use Fill Down?
  8. What is a custom column?
  9. How do you join two tables in Power Query?
  10. What does Group By do?
  11. Give an example of Pivot.
  12. Why should you keep only important columns?
  13. What is the shortcut for Undo?
  14. What is a delimiter? Give two examples.
  15. Why is clean data better than dirty data?

✍️ Fill‑in‑the‑Blank

  1. Data cleaning means fixing _______ and removing useless parts.
  2. _______ copies a value from above to empty cells below.
  3. _______ tells the computer if data is text, number, or date.
  4. _______ combines two tables using a common column.
  5. _______ turns rows into columns.

✅ True or False

  1. Blank rows are helpful for analysis. (False)
  2. You should always change data type before adding numbers. (True)
  3. Merge is the same as split. (False)
  4. Fill Down copies data from the row below. (False – it copies from above)
  5. Pivot turns rows into columns. (True)

🔘 Multiple Choice Questions

  1. Which operation removes blank rows?
    a) Split b) Remove Rows c) Merge d) Pivot
    Answer: b
  2. Which is NOT a data type?
    a) Text b) Number c) Colour d) Date
    Answer: c
  3. What does Fill Down do?
    a) Copies value from above b) Copies from below c) Splits data d) Merges data
    Answer: a
  4. Which is used to combine two tables?
    a) Split b) Merge c) Pivot d) Group By
    Answer: b
  5. Group By is used to …
    a) Split columns b) Summarise categories c) Fix spelling d) Change types
    Answer: b
  6. What is a delimiter?
    a) A number b) A separator symbol c) A data type d) A column
    Answer: b
  7. Which turns rows into columns?
    a) Unpivot b) Pivot c) Merge d) Fill Down
    Answer: b
  8. Which shortcut is Undo?
    a) Ctrl+Z b) Ctrl+C c) Ctrl+V d) Ctrl+X
    Answer: a
  9. Why change data type?
    a) For colour b) So Power Query understands c) To delete rows d) To split columns
    Answer: b
  10. Which is a best practice?
    a) Keep dirty data b) Keep a copy of original c) Never undo d) Ignore blanks
    Answer: b
  11. What does Unpivot do?
    a) Turns columns into rows b) Turns rows into columns c) Merges tables d) Sorts data
    Answer: a
  12. Which column operation separates first and last name?
    a) Merge b) Split c) Group By d) Fill Down
    Answer: b
  13. What is a custom column?
    a) A column you create with a formula b) A pre‑made column c) A blank column d) A column with errors
    Answer: a
  14. Which is NOT a cleaning step?
    a) Fix spelling b) Remove blanks c) Add random data d) Change types
    Answer: c
  15. What should you do before analysing?
    a) Clean data b) Delete everything c) Merge all tables d) Pivot everything
    Answer: a

🔗 Matching Exercises

Match the term with its description:

TermDescription
1. SplitA. Combine two tables
2. MergeB. Separate one column into two
3. PivotC. Turns rows into columns
4. Group ByD. Summarise by category

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

✏️ Short Answer Questions

  1. Explain why you should remove blank rows before analysis.
  2. Describe the steps to split a column by space.
  3. What is the difference between Merge and Group By?
  4. Give two examples of data types.
  5. Why is it useful to keep a copy of the original data?

📖 Scenario‑based Exercises

Scenario 1: You have a list of 100 students with names like “Ade Ojo”, “Bola”, “Chidi Eze” (missing last name). How would you clean this? (Answer: split full name where possible, leave missing as blank or fix manually.)

Scenario 2: Your teacher gave you two tables – one with student IDs and names, another with student IDs and test scores. How can you combine them? (Answer: merge on Student ID.)

👥 Group Activity

In small groups, create a messy data table with at least 10 rows and 4 columns (include spelling errors, blanks, mixed capitals). Exchange tables with another group and clean each other’s data using the steps learned.

🧑‍🎓 Individual Activity

Open Excel or Power Query (if available). Take the class attendance list and clean it: remove empty rows, fix names, and change the date column to Date type.

🗣️ Classroom Discussion Questions

  1. Why is clean data important for making decisions?
  2. What happens if you forget to change a data type?
  3. When would you use Pivot instead of Group By?

🛠️ Mini Project

Collect data from your classmates: Name, Age, Favourite Subject, and Score in Maths (out of 100). Type it into Excel. Use Power Query to: (1) Remove blank rows, (2) Split name into first and last, (3) Change Age to number, (4) Sort by Score descending. Show your clean table.

💻 Practical Assignment

Download a sample dataset from the internet (or use a provided one). Clean it using at least 5 different operations (remove blanks, fix capitals, split, merge, change type). Submit the cleaned file and a short report of what you did.

🏆 Challenge Exercise

You have a table with “Product”, “Region”, “Sales”, “Quarter”. Use Power Query to: (1) Unpivot the quarters, (2) Group by Region to find total sales, (3) Merge with a product category table (provided) to add category information. This is tricky – try your best!

🔍 Quiz Answers

Fill‑in‑the‑Blank: 1. errors 2. Fill Down 3. Data type 4. Merge 5. Pivot

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

Multiple Choice: 1-b, 2-c, 3-a, 4-b, 5-b, 6-b, 7-b, 8-a, 9-b, 10-b, 11-a, 12-b, 13-a, 14-c, 15-a

🎁 Key Takeaways

  • Clean data is the foundation of good analysis.
  • Power Query offers many tools to fix and shape data.
  • Always check data types and remove blanks.
  • Practice makes perfect – keep experimenting!

🔜 Preparation for Module Five

In the next module, we will dive into “Data Transformation with M Language”. You will learn how to write simple code to automate all the cleaning steps we did manually. Get ready to become a Power Query wizard!

Note: This is Module Four. In our course, Module Three covers “Connecting to Data Sources”. We will now transition to Module Five, but you have mastered the art of cleaning – well done!

🏆 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.
→