Welcome to Module 3!
In the previous module, you learned how to open Power BI Desktop, understand its interface, and save your first Power BI file.
Now, imagine you are a teacher in a secondary school in Ibadan. You have an Excel file containing the names, ages, classes, and examination scores of 100 students.
You want to use Power BI to create charts showing the students' performance. But how will you move the information from Excel into Power BI?
You need to connect to a data source and import the data.
In this module, you will learn how to bring information from Excel files, CSV files, and databases into Power BI.
A data source is the place where information is stored or collected.
Think about your school. Your teacher may keep students' names and examination scores in an Excel spreadsheet. That Excel file is a data source.
A supermarket may store information about its products and customers in a database. That database is also a data source.
Power BI can connect to different data sources and use the information to create reports.
Microsoft Excel is one of the most common sources of data used in Power BI.
Excel allows people to organise information using rows, columns, and worksheets.
Imagine a school keeps the following student records in Excel:
| Student Name | Class | Subject | Score |
|---|---|---|---|
| David | JSS 2 | Mathematics | 85 |
| Mary | JSS 2 | Mathematics | 92 |
| John | JSS 2 | Mathematics | 70 |
| Sarah | JSS 2 | Mathematics | 78 |
Power BI can read this information and help the teacher create a report showing the students' scores.
Let's learn how to connect an Excel file to Power BI Desktop.
After loading, the information will appear in the Data pane and can be used to create visualisations.
CSV means Comma-Separated Values.
A CSV file is a simple file format used to store information in rows and columns. Each value is usually separated by a comma.
For example, imagine a CSV file containing student information:
Student Name,Class,Subject,Score David,JSS 2,Mathematics,85 Mary,JSS 2,Mathematics,92 John,JSS 2,Mathematics,70 Sarah,JSS 2,Mathematics,78
Each line represents a record, while commas separate the individual values.
CSV files are useful because many applications can create and read them.
Your CSV information is now available for analysis in Power BI.
A database is a system used to store and organise information so that it can be accessed, managed, and updated.
Imagine a large bank has millions of customer records. It would be difficult to manage all that information using ordinary paper documents.
The bank can use a database to store information such as:
Power BI can connect to supported databases and use their information to create reports.
Some database connections may require additional drivers, permissions, network access, or configuration.
When connecting to some data sources, Power BI allows you to choose how it accesses the information.
Two important connection modes are Import and DirectQuery.
Import mode copies selected data into the Power BI model.
Imagine you have an Excel file containing the sales records of a supermarket. When you import the information, Power BI loads a copy of the selected data into its model.
Power BI can then analyse the imported information without requesting every value from the original source each time you interact with a report.
When the original data changes, you normally need to refresh the Power BI data to bring in the updates.
DirectQuery allows Power BI to query the original data source when users interact with reports, rather than importing all the data into the Power BI model.
For example, a company may keep its sales records in a database. With DirectQuery, Power BI sends queries to that database to retrieve the information needed for a visual.
The results depend on the database, network connection, and the way the report is designed.
| Import Mode | DirectQuery Mode |
|---|---|
| Loads a copy of selected data into the Power BI model. | Queries the original data source when needed. |
| Usually provides fast report interactions after data is loaded. | Performance depends partly on the source system and connection. |
| Needs refreshing to bring in later changes from the source. | Can retrieve updated source information when queries run. |
| Uses storage in the Power BI model. | Keeps the main data in the original source. |
Simple example: Import is like bringing a copy of your class register into your notebook. DirectQuery is like checking the official class register whenever you need information.
Before importing information into Power BI, it is important to check whether the data looks correct.
This is called previewing data.
Imagine you are importing a supermarket sales file. You should check that:
Previewing helps you discover problems before using the information to create reports.
| Problem | Example |
|---|---|
| Missing value | A student has no examination score. |
| Wrong data type | A sales amount is treated as text. |
| Incorrect heading | A column is named Column1 instead of Product. |
| Unwanted records | A blank row appears in the file. |
Some problems can be corrected in Power Query before the data is loaded.
After selecting a data source and checking its information, the next step is loading the data.
Loading data means bringing the selected information into your Power BI model so that you can use it in reports and visualisations.
You can now use the imported fields to create charts and reports.
Imagine you are helping a teacher in a secondary school in Ibadan. The teacher wants to analyse the examination results of five students.
First, create a small table in Microsoft Excel using the following information:
| Student | Class | Subject | Score |
|---|---|---|---|
| David | JSS 2 | Mathematics | 85 |
| Mary | JSS 2 | Mathematics | 92 |
| John | JSS 2 | Mathematics | 70 |
| Sarah | JSS 2 | Mathematics | 78 |
| Peter | JSS 2 | Mathematics | 88 |
Your tasks:
Challenge: Can you identify the student with the highest examination score without using a calculator?
| Term | Simple Meaning |
|---|---|
| Data Source | A place where information is stored or collected. |
| Excel Workbook | An Excel file containing worksheets and information. |
| CSV | A file format that stores values separated by commas or other delimiters. |
| Database | A system for storing and organising information. |
| Import Mode | A connection mode that loads a copy of selected data into Power BI. |
| DirectQuery | A mode that queries the original data source when needed. |
| Data Preview | Checking information before loading it. |
| Load | Bringing selected data into the Power BI model. |
Choose the correct answer for each question.
In this module, you learned how to connect Power BI to different data sources. You discovered how to import information from Microsoft Excel and CSV files, and how Power BI connects to databases.
You also learned the difference between Import and DirectQuery modes, how to preview information, and how to load data into Power BI.
Remember, before creating a report, you need information to work with. Connecting to a data source is one of the first steps in data analysis.
Cleaning and Preparing Data with Power Query: You will learn how to remove duplicate records, handle missing values, correct data types, rename columns, split information, and prepare your data for accurate analysis.