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

Module Eight

๐Ÿ“– 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.
9
Module 8 ยท Power Query for Data Analysis Expert

๐Ÿงฉ Module Eight: Combining Data Like a Puzzle Master

Hello, young data explorer! Welcome to Module Eight. In this module, we will learn how to combine data from different places. Imagine you have two puzzle pieces. Alone, they don't show the whole picture. But when you join them together, you see the complete image. That's what combining data does โ€“ it brings together information from different tables to give you a full story. We will learn about merging (like joining two lists side by side) and appending (like stacking one list on top of another). By the end of this module, you will be a Data Puzzle Master!

๐ŸŽฏ Learning Objectives

  • Understand what combining data means.
  • Learn the difference between merging and appending.
  • Learn how to perform a merge (join) in Power Query.
  • Learn about different join types: Inner, Left Outer, Right Outer, Full Outer.
  • Learn how to append (stack) tables.
  • Understand how to combine data from multiple files in a folder.
  • Learn how to use the "Merge" and "Append" buttons in Power Query.
  • Learn how to handle mismatched keys.
  • Understand the importance of a unique identifier (key).
  • Learn how to combine data without losing information.
  • Use combined data for better analysis.

๐Ÿ“– Warm-up Story: The Two Class Lists

Ngozi is the class prefect. She has two lists. List A has student names and their test scores. List B has student names and their project scores. But the lists are separate. Ngozi wants to see each student's total score (test + project). She decides to combine the two lists. She matches each student from List A with the same student in List B. If a student is missing in one list, she writes "Absent". After combining, she has a complete table with all scores. That's what we will do with Power Query โ€“ combine tables to see the whole picture!

๐Ÿ“š Main Lessons (15 Lessons)

Lesson 1: What is Combining Data?

Definition: Combining data means taking two or more tables and joining them together.

Why important: Often your data is spread across different files. Combining helps you see everything in one place.

Simple explanation: It's like putting together pieces of a jigsaw puzzle to see the complete picture.

Real-life example: A company has a table of employees and a table of salaries. They combine them to get a full employee record.

School example: You have a list of students and a list of their favourite subjects. Combining gives you a list with both.

Home example: You have a list of family members and a list of their birthdays. Combine to see everyone's birthday.

Nigerian example: A bank has customer account details and transaction history. They combine them to see each customer's transactions.

Illustration:

Table 1 (Students)   +   Table 2 (Scores)   =   Combined Table
+----+-------+          +----+-------+         +----+-------+-------+
| ID | Name  |          | ID | Score |         | ID | Name  | Score |
+----+-------+          +----+-------+         +----+-------+-------+
| 1  | Bola  |          | 1  | 90    |         | 1  | Bola  | 90    |
| 2  | Tunde |          | 2  | 85    |         | 2  | Tunde | 85    |
+----+-------+          +----+-------+         +----+-------+-------+

Mini summary: Combining data brings separate tables together into one.

Lesson 2: Merging vs. Appending

Definition: Merging adds columns from one table to another (side by side). Appending stacks rows from one table to another (top to bottom).

Why important: You need to know which method to use depending on what you want.

Simple explanation: Merging is like adding new clothes to your wardrobe (new columns). Appending is like adding more clothes of the same type (more rows).

Real-life example: Merging: adding phone numbers to a contact list. Appending: adding new contacts to the list.

School example: Merging: adding grades to student names. Appending: adding students from another class.

Home example: Merging: adding prices to grocery items. Appending: adding more grocery items.

Nigerian example: Merging: adding LGA to a list of states. Appending: adding data from another state.

Illustration:

Merging (side by side):
Table A: ID, Name   +   Table B: ID, Age   =   Table C: ID, Name, Age

Appending (top to bottom):
Table A: ID, Name   +   Table B: ID, Name   =   Table C: ID, Name (more rows)

Mini summary: Merge = add columns. Append = add rows.

Lesson 3: Understanding Keys (The Matchmaker)

Definition: A key is a column that uniquely identifies each row (e.g., Student ID).

Why important: When merging, the key tells Power Query how to match rows from the two tables.

Simple explanation: It's like a secret code that two friends use to find each other in a crowd.

Real-life example: In a school, student ID is the key to match students with their grades.

School example: Your admission number is the key.

Home example: Your family member's name is a key to find their age.

Nigerian example: NIN (National Identification Number) is a key to match citizens with their records.

Illustration:

Table 1 (Key = ID)    Table 2 (Key = ID)     Merge on ID
+----+-------+        +----+-------+        +----+-------+-------+
| ID | Name  |        | ID | Score |        | ID | Name  | Score |
+----+-------+        +----+-------+        +----+-------+-------+
| 1  | Bola  |        | 1  | 90    |        | 1  | Bola  | 90    |
| 2  | Tunde |        | 2  | 85    |        | 2  | Tunde | 85    |
+----+-------+        +----+-------+        +----+-------+-------+

Mini summary: A key is a special column that matches rows from different tables.

Lesson 4: Inner Join โ€“ Keep Only Matches

Definition: Inner join keeps only rows that have a match in both tables.

Why important: Use this when you only want records that exist in both tables.

Simple explanation: If two friends both have the same secret code, they meet. If one doesn't have it, they don't meet.

Real-life example: You have a list of students and a list of those who paid fees. Inner join gives only students who have paid.

School example: List of subjects and list of teachers. Inner join gives subjects that have a teacher assigned.

Home example: List of family members and list of those who like pizza. Inner join gives family members who like pizza.

Nigerian example: Voter register and election results. Inner join gives only voters who voted.

Illustration:

Table A: ID, Name        Table B: ID, Score
1, Bola                  1, 90
2, Tunde                 3, 88   โ† ID 3 not in A
Inner Join on ID โ†’ only ID 1 (Bola, 90) because ID 2 in A but not in B? Actually ID 2 in A, not in B, so not kept.
Result: ID 1: Bola, 90

Mini summary: Inner join keeps only rows that appear in both tables.

Lesson 5: Left Outer Join โ€“ Keep All from Left

Definition: Left outer join keeps all rows from the left table, and matching rows from the right. If no match, right side is null (empty).

Why important: Use this when you don't want to lose any rows from the main table.

Simple explanation: The left table is the boss. It keeps all its rows. The right table is a friend โ€“ if it has a match, it joins; if not, it leaves a blank.

Real-life example: You have a list of all students (left) and test scores (right). You want all students, even if they have no score.

School example: All students and their project scores. You want to see all students, even those who didn't submit a project.

Home example: Family members and their chores. You want all members, even if they have no chore.

Nigerian example: All customers and their orders. You want all customers, even those who haven't ordered.

Illustration:

Left Table: ID, Name       Right Table: ID, Score
1, Bola                    1, 90
2, Tunde                   3, 88
3, Zain
Left Outer Join โ†’ all from left:
1, Bola, 90
2, Tunde, null (no score)
3, Zain, null (no score)

Mini summary: Left outer join keeps all rows from the left table.

Lesson 6: Right Outer Join โ€“ Keep All from Right

Definition: Right outer join keeps all rows from the right table, and matching rows from the left. If no match, left side is null.

Why important: Use this when the right table is your main focus.

Simple explanation: Now the right table is the boss.

Real-life example: You have a list of products (right) and a list of sales (left). You want all products, even if they have no sales.

School example: Subjects (right) and teachers (left). You want all subjects, even if no teacher assigned.

Home example: Chores (right) and family members (left). You want all chores, even if no one does them.

Nigerian example: States (right) and governors (left). You want all states, even if some have no governor data.

Illustration:

Left Table: ID, Name       Right Table: ID, Score
1, Bola                    1, 90
2, Tunde                   3, 88
                           4, 95
Right Outer Join โ†’ all from right:
1, Bola, 90
3, null, 88
4, null, 95

Mini summary: Right outer join keeps all rows from the right table.

Lesson 7: Full Outer Join โ€“ Keep All from Both

Definition: Full outer join keeps all rows from both tables. If a row doesn't have a match, the missing side is null.

Why important: Use when you want to see everything from both tables.

Simple explanation: Both tables are bosses. Everyone is included.

Real-life example: You have a list of employees and a list of departments. You want to see all employees and all departments, even if some employees are not assigned to a department.

School example: Students and clubs. You want all students and all clubs.

Home example: Family members and hobbies. You want all members and all hobbies.

Nigerian example: Companies and products. You want all companies and all products.

Illustration:

Left: 1, Bola ; 2, Tunde   Right: 1, 90 ; 3, 88
Full Outer โ†’ 
1, Bola, 90
2, Tunde, null
3, null, 88

Mini summary: Full outer join keeps all rows from both tables.

Lesson 8: How to Merge in Power Query

Definition: Merging in Power Query is done using the "Merge Queries" button.

Why important: This is the main tool you will use to combine tables.

Simple explanation: It's like clicking a magic button that joins your tables.

Real-life example: You have two Excel sheets. You merge them to create one.

School example: You have a class list and a grade list. Merge to get grades for each student.

Home example: You have a grocery list and a price list. Merge to get total cost.

Nigerian example: You have a list of LGAs and a list of populations. Merge to have population per LGA.

How to do it: In Power Query, go to the "Home" tab, click "Merge Queries", select the two tables, choose the key column, and select the join type.

Illustration:

Step 1: Home โ†’ Merge Queries
Step 2: Select Table 1 and Table 2
Step 3: Choose key column (e.g., ID) from each
Step 4: Choose join type (Inner, Left, etc.)
Step 5: Click OK โ†’ new column with nested tables
Step 6: Expand the new column to get the data.

Mini summary: Merge Queries is the tool to combine tables in Power Query.

Lesson 9: Appending in Power Query

Definition: Appending adds rows from one table to another. Both tables must have the same column structure.

Why important: Use this when you have data split across multiple files (e.g., sales by month).

Simple explanation: It's like stacking books on top of each other.

Real-life example: You have sales for January in one file and sales for February in another. Append them to get all sales.

School example: Class A attendance and Class B attendance. Append to get total attendance.

Home example: Expenses for week 1 and week 2. Append to get monthly expenses.

Nigerian example: COVID-19 data for Lagos and COVID-19 data for Abuja. Append to get national data.

How to do it: Home tab โ†’ Append Queries โ†’ Select the tables to append.

Illustration:

Table A: ID, Name    Table B: ID, Name    Append โ†’ 
1, Bola              3, Zain              1, Bola
2, Tunde             4, Amina             2, Tunde
                                          3, Zain
                                          4, Amina

Mini summary: Append stacks rows.

Lesson 10: Combining Data from Multiple Files in a Folder

Definition: Power Query can combine all files in a folder (e.g., all CSV files).

Why important: Saves time when you have many files.

Simple explanation: It's like putting all your toys from different boxes into one big toy box.

Real-life example: A company has daily sales files for a year. Power Query combines them into one table.

School example: You have homework files for each subject. Combine them into one file.

Home example: You have photos from different holidays. Combine them into one album.

Nigerian example: A bank has monthly account statements. Combine them into yearly statement.

How to do it: Get Data โ†’ From Folder โ†’ Browse to folder โ†’ Combine & Transform.

Illustration:

Folder: Sales
   |-- Jan.csv
   |-- Feb.csv
   |-- Mar.csv
      ...
Power Query combines all into one Sales table.

Mini summary: Combine from folder is a powerful way to merge many files.

Lesson 11: Handling Mismatched Keys

Definition: Mismatched keys happen when the key column has different values in the two tables (e.g., "1" vs "01").

Why important: If keys don't match, your merge will be wrong.

Simple explanation: If two friends have different secret codes, they can't find each other.

Real-life example: Student ID in one table is "100" and in another is "00100". They don't match.

School example: Your name is "Tunde" in one list and "Tunde O." in another. Not exactly the same.

Home example: "Dad" in one list and "Father" in another.

Nigerian example: Phone number has different formats (080 vs +23480).

How to fix: Before merging, transform the key columns to be the same (e.g., trim, format, convert to text).

Illustration:

Table A: ID = "001"    Table B: ID = "1"   โ†’   Convert both to text and trim.
Then they match: "001" and "1" are different, so we might need to convert to number: 1 and 1 match.

Mini summary: Always ensure keys match exactly before merging.

Lesson 12: Expanding Nested Tables After Merge

Definition: After a merge, Power Query creates a new column containing nested tables. You need to expand it to see the data.

Why important: Without expanding, you only see the word "Table".

Simple explanation: It's like opening a gift box to see the present inside.

Real-life example: You merged, and you see a column with "Table". Click the expand icon to get the actual data.

School example: You merged grades, and you see "Table". Expand to see scores.

Home example: You merged prices, and you see "Table". Expand to see prices.

Nigerian example: You merged populations, expand to see population numbers.

How to do it: Click the expand icon (two arrows) on the new column header, select the columns you want, and click OK.

Illustration:

After Merge:
+----+-------+-------------+
| ID | Name  | Merged      |
+----+-------+-------------+
| 1  | Bola  | Table       |  โ† Click expand
+----+-------+-------------+

After Expand:
+----+-------+-------+
| ID | Name  | Score |
+----+-------+-------+
| 1  | Bola  | 90    |
+----+-------+-------+

Mini summary: Expand nested tables to see the actual data.

Lesson 13: Join with Multiple Columns

Definition: Sometimes you need to match on two or more columns (e.g., First Name and Last Name).

Why important: Single key might not be unique.

Simple explanation: You use two clues to find your friend: name and age.

Real-life example: Match customers by first name and last name together.

School example: Match students by class and roll number.

Home example: Match chores by day and person.

Nigerian example: Match citizens by state and LGA.

How to do it: In the merge dialog, select multiple columns from each table (hold Ctrl to select multiple).

Illustration:

Table A: First, Last, Age   Table B: First, Last, Score
Merge on First AND Last.

Mini summary: You can merge on multiple columns for a better match.

Lesson 14: Fuzzy Matching (Approximate Match)

Definition: Fuzzy matching allows matches even if the key is not exactly the same (e.g., "Bola" and "Bolah").

Why important: Handles typos or slight differences.

Simple explanation: It's like guessing a friend's name even if you spell it a little wrong.

Real-life example: "Ade" and "Adeyemi" might be matched.

School example: "Maths" and "Mathematics" might be matched.

Home example: "Soda" and "Pop" might be matched.

Nigerian example: "Lagos" and "Lag" might be matched.

How to do it: In merge dialog, check "Use fuzzy matching" and adjust similarity threshold.

Illustration:

Table A: "Bola"   Table B: "Bolah"   Fuzzy match โ†’ treated as same.

Mini summary: Fuzzy matching helps when data has small differences.

Lesson 15: Combining Data โ€“ Best Practices

Definition: Follow these tips for successful data combining.

Why important: Avoids errors and makes your work easier.

Simple explanation: Like following a recipe to bake a perfect cake.

  • Always check your keys โ€“ make sure they are clean and match.
  • Know whether you need to merge or append.
  • Test with a small sample first.
  • Use descriptive names for your merged queries.
  • Document your steps.

Illustration:

Best Practice Flow:
1. Clean keys (trim, remove spaces)
2. Decide merge or append
3. Perform merge/append
4. Expand if needed
5. Check result
6. Rename columns

Mini summary: Good planning leads to successful combining.

๐Ÿ“– Key Vocabulary (with simple definitions)

  • Combine: To join two or more things together.
  • Merge: To add columns from one table to another.
  • Append: To add rows from one table to another.
  • Key: A column that uniquely identifies a row (like an ID).
  • Inner Join: Keeps rows that match in both tables.
  • Left Outer Join: Keeps all rows from the left table.
  • Right Outer Join: Keeps all rows from the right table.
  • Full Outer Join: Keeps all rows from both tables.
  • Expand: To show the data inside a nested table.
  • Fuzzy Matching: Approximate matching for slight differences.

๐Ÿง  Important Concepts

  • Unique Identifier: Every row should have a unique key for accurate merging.
  • Join Types: Choose the right join type based on what you need to keep.
  • Data Consistency: Ensure key columns have the same data type and format.
  • Expansion: Always expand merged columns to get the actual data.

๐Ÿ”ข Step-by-Step Explanations

How to Merge Two Tables:

  1. Load both tables into Power Query.
  2. Go to Home tab โ†’ Merge Queries.
  3. Select the first table and the second table.
  4. Choose the key column from each table.
  5. Select the join type (Inner, Left, etc.).
  6. Click OK.
  7. Click the expand icon on the new column.
  8. Select the columns you want to add.
  9. Click OK. You now have a combined table.

How to Append Two Tables:

  1. Load both tables into Power Query.
  2. Go to Home tab โ†’ Append Queries.
  3. Select the tables to append.
  4. Click OK. The rows are stacked.

๐ŸŒ Real-life Examples

  • Retail: Merge product details with sales transactions to analyze product performance.
  • Healthcare: Append patient records from different hospitals to get a national view.
  • Finance: Merge customer data with account data for a complete customer profile.

๐Ÿ‡ณ๐Ÿ‡ฌ Nigerian Examples

  • Election: Merge voter register with polling unit data to analyze voting patterns.
  • Agriculture: Append crop production data from all states to get national production.
  • Telecom: Merge call detail records with customer plans to analyze usage.

๐ŸŽˆ Fun Examples Children Can Relate To

  • Toys: Merge a list of toys with a list of prices to get a catalog.
  • Candy: Append candy sales for Monday and Tuesday to get weekly sales.
  • Friends: Merge two lists of friends from different classes to get a combined list.

๐Ÿ  Everyday Examples

  • Phonebook: Merge contacts from your school and home.
  • Shopping: Append grocery lists from different trips to see total items.
  • Chores: Merge chore lists for each day into a weekly schedule.

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

  • Use analogies like puzzles and Lego blocks to explain combining.
  • Demonstrate with real datasets from Excel.
  • Emphasize the importance of clean keys before merging.

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

  • Help your child find two lists at home (e.g., grocery items and prices) and merge them.
  • Explain how combining data is like matching socks โ€“ you need to find the pairs.

๐Ÿ’ก Interesting Facts

  • Power Query can combine data from Excel, CSV, databases, web, and more.
  • Combining data is often called "data integration".
  • Merging is one of the most frequently used operations in Power Query.

โ“ Did You Know?

Did you know that Power Query can combine data from thousands of files in a folder in just a few clicks? That's powerful!

๐Ÿ”” Remember This

  • Merging adds columns, appending adds rows.
  • Always choose the right join type.
  • Keys must match exactly for a perfect merge.
  • Expand nested tables to see the data.

โš ๏ธ Common Mistakes

  • Forgetting to expand after merge โ€“ you see "Table" instead of data.
  • Using the wrong join type โ€“ losing important rows.
  • Keys not matching โ€“ wrong or missing matches.
  • Appending tables with different column names โ€“ causes errors.

โœ… Best Practices

  • Clean your keys before merging (trim, remove spaces).
  • Use a unique key for each row.
  • Test merge with a small sample first.
  • Rename columns after merging for clarity.

๐Ÿ“Š ASCII Illustrations

Merge vs Append

Merge (side by side):
+-------+-------+   +-------+-------+   +-------+-------+-------+
| ID    | Name  |   | ID    | Score |   | ID    | Name  | Score |
+-------+-------+   +-------+-------+   +-------+-------+-------+
| 1     | Bola  |   | 1     | 90    |   | 1     | Bola  | 90    |
| 2     | Tunde |   | 2     | 85    |   | 2     | Tunde | 85    |
+-------+-------+   +-------+-------+   +-------+-------+-------+

Append (top to bottom):
+-------+-------+   +-------+-------+   +-------+-------+
| ID    | Name  |   | ID    | Name  |   | ID    | Name  |
+-------+-------+   +-------+-------+   +-------+-------+
| 1     | Bola  |   | 3     | Zain  |   | 1     | Bola  |
| 2     | Tunde |   | 4     | Amina |   | 2     | Tunde |
+-------+-------+   +-------+-------+   | 3     | Zain  |
                                          | 4     | Amina |
                                          +-------+-------+

Join Types Comparison

Inner Join:   Keeps only matching rows.
Left Outer:   Keeps all from left, matches from right.
Right Outer:  Keeps all from right, matches from left.
Full Outer:   Keeps all from both.

๐Ÿ“‹ Comparison Tables

Merge vs Append

FeatureMergeAppend
What it addsColumnsRows
RequiresKey columnSame column structure
Use whenYou want to combine different informationYou want to combine same information from different sources

Join Types

Join TypeKeepsUse case
InnerOnly matchesWhen you need only common records
Left OuterAll from leftWhen left table is main
Right OuterAll from rightWhen right table is main
Full OuterAll from bothWhen you need everything

๐Ÿ“ End-of-Module Summary

Congratulations! You have completed Module Eight on Combining Data. You learned:

  • The difference between merging (adds columns) and appending (adds rows).
  • What a key is and why it's important for merging.
  • The four join types: Inner, Left Outer, Right Outer, and Full Outer.
  • How to merge and append in Power Query.
  • How to combine data from multiple files in a folder.
  • How to handle mismatched keys and expand nested tables.
  • Fuzzy matching for approximate matches.

Combining data is like being a master puzzle solver. You take different pieces and put them together to see the big picture. Now you can combine any data with confidence!

โ“ Frequently Asked Questions (10)

  1. What is the difference between merge and append? โ€“ Merge adds columns, append adds rows.
  2. What is a key? โ€“ A unique column that identifies each row.
  3. What is an Inner Join? โ€“ Keeps only rows that match in both tables.
  4. What is a Left Outer Join? โ€“ Keeps all rows from the left table.
  5. What is a Right Outer Join? โ€“ Keeps all rows from the right table.
  6. What is a Full Outer Join? โ€“ Keeps all rows from both tables.
  7. Why do I see "Table" after merging? โ€“ You need to expand the nested table.
  8. Can I merge on multiple columns? โ€“ Yes, select multiple columns as keys.
  9. What is fuzzy matching? โ€“ Approximate matching for slight differences.
  10. How do I combine files from a folder? โ€“ Use Get Data โ†’ From Folder.

๐Ÿ“ Review Questions (15)

  1. What is combining data?
  2. What is the difference between merging and appending?
  3. What is a key?
  4. Name the four join types.
  5. Which join keeps all rows from the left table?
  6. Which join keeps only matching rows?
  7. How do you expand a nested table after merge?
  8. Why should you clean keys before merging?
  9. What is the purpose of appending?
  10. How do you combine all files in a folder?
  11. What is fuzzy matching?
  12. When would you use a Full Outer Join?
  13. What is a unique identifier?
  14. Can you merge on multiple columns? How?
  15. What is the first step before merging?

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

  1. ______ adds columns to a table.
  2. ______ adds rows to a table.
  3. A ______ is a column that uniquely identifies each row.
  4. ______ join keeps only rows that match in both tables.
  5. ______ join keeps all rows from the left table.

โœ… True or False Exercises

  1. Merging adds rows. (False)
  2. Appending adds columns. (False)
  3. A key is used to match rows during a merge. (True)
  4. Inner join keeps all rows from both tables. (False โ€“ it keeps only matches)
  5. Left Outer join keeps all rows from the left table. (True)

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

  1. Which operation adds columns to a table?
    a) Append b) Merge c) Trim d) Split
    Answer: b
  2. Which operation adds rows to a table?
    a) Append b) Merge c) Trim d) Split
    Answer: a
  3. What is a key?
    a) A random number b) A unique identifier c) A date d) A text
    Answer: b
  4. Which join keeps only matching rows?
    a) Inner b) Left Outer c) Right Outer d) Full Outer
    Answer: a
  5. Which join keeps all rows from the left table?
    a) Inner b) Left Outer c) Right Outer d) Full Outer
    Answer: b
  6. Which join keeps all rows from both tables?
    a) Inner b) Left Outer c) Right Outer d) Full Outer
    Answer: d
  7. What do you click to expand a nested table?
    a) Refresh b) Expand icon c) Delete d) Rename
    Answer: b
  8. What is fuzzy matching?
    a) Exact match b) Approximate match c) No match d) Random match
    Answer: b
  9. Which is NOT a join type?
    a) Inner b) Outer c) Middle d) Full Outer
    Answer: c
  10. How do you combine files from a folder?
    a) Append b) Merge c) From Folder d) Split
    Answer: c
  11. What should you do before merging?
    a) Clean keys b) Delete rows c) Add columns d) Save file
    Answer: a
  12. Which join keeps all rows from the right table?
    a) Inner b) Left Outer c) Right Outer d) Full Outer
    Answer: c
  13. What is the purpose of a key?
    a) To sort data b) To identify rows uniquely c) To add columns d) To delete data
    Answer: b
  14. Can you merge on multiple columns?
    a) Yes b) No c) Only if they are numbers d) Only if they are dates
    Answer: a
  15. What happens if keys don't match?
    a) Merge fails b) Wrong matches c) Both a and b d) Nothing
    Answer: c

๐Ÿ”— Matching Exercises

Match the term to its definition:

TermDefinition
1. MergeA. Add rows
2. AppendB. Add columns
3. KeyC. Approximate match
4. Inner JoinD. Unique identifier
5. Fuzzy MatchingE. Keep only matches

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

โœ๏ธ Short Answer Questions

  1. Explain the difference between merging and appending.
  2. What is a key and why is it important?
  3. Describe the four join types.
  4. How do you expand a nested table in Power Query?
  5. What is fuzzy matching and when would you use it?

๐Ÿ“– Scenario-based Exercises

Scenario 1: You have a table of students (ID, Name) and a table of grades (ID, Grade). You want a table with all students and their grades, but some students have no grade. Which join would you use? Write the steps.

Scenario 2: You have sales data for January and February in separate files. Both files have the same columns. How would you combine them? What is this operation called?

๐Ÿ‘ฅ Group Activity

In groups, get two sample datasets (e.g., customer data and order data). Decide which join type to use. Perform the merge in Power Query. Present the result to the class.

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

Create two small tables in Excel: one with student IDs and names, another with student IDs and scores. Import them into Power Query, perform a Left Outer Join, and expand the result.

๐Ÿ’ฌ Classroom Discussion Questions

  • Why is it important to choose the right join type?
  • What happens if you forget to expand after a merge?
  • Can you think of a real-life situation where you would append data?

๐Ÿ› ๏ธ Mini Project

Project: Combine Sales Data

You have sales data for four quarters (Q1, Q2, Q3, Q4) in separate Excel files. Each file has the same columns: Product, Salesperson, Amount. Combine all four files into one table using Power Query (append). Then, merge this with a product details table (Product, Category) to add category information. Present the final combined table.

๐Ÿ“‹ Practical Assignment

Download two datasets from the internet (e.g., customer list and purchase history). Use Power Query to:

  1. Clean both datasets (remove duplicates, trim).
  2. Perform an Inner Join on customer ID.
  3. Expand the merged column.
  4. Save the final table.

๐Ÿ† Challenge Exercise

You have three tables: Students (ID, Name), Subjects (SubjectID, SubjectName), and Scores (ID, SubjectID, Score). Write the steps to combine all three tables into one table that shows each student's name, subject, and score. Which joins would you use? Perform the steps in Power Query.

๐Ÿ“ Quiz Answers

Fill-in-the-Blank: 1. Merge, 2. Append, 3. key, 4. Inner, 5. Left Outer

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

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

๐Ÿ”‘ Key Takeaways

  • Combining data brings different tables together.
  • Merge adds columns, append adds rows.
  • A key is essential for a successful merge.
  • Choose the right join type for your analysis.
  • Always expand nested tables after merging.
  • Clean keys before merging for best results.

๐Ÿ“– Preparation for the Next Module

In Module Nine, we will learn about Grouping and Aggregating data. We will summarize data (like total sales per product) and group rows to get insights. Get ready to become a Data Summarizer!

Before the next class, practice merging and appending with different datasets. Try to combine data from at least two different sources.


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

๐Ÿ† 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.
โ†’