Connecting Power BI to Various Data Sources
This module teaches how to connect Power BI to multiple data sources. Learners will understand the differences between Import and DirectQuery modes, explore structured and unstructured data sources, and practice loading and previewing data to build the foundation for reports and dashboards.
1. Connecting to Excel, CSV, and Other Flat Files
Power BI can directly connect to Excel files (.xlsx), CSV files, and other flat files. This is ideal for small datasets or initial reporting.
Example:
- An Excel sheet contains monthly sales:
| ProductSales AmountMonth | ||
| A | 100000 | Jan |
| B | 80000 | Jan |
- Connect the Excel file to Power BI Desktop and load it as a dataset.
2. Connecting to Databases: SQL Server, MySQL, Oracle
Power BI can query live or imported data from relational databases.
- SQL Server: Enter server name and database, choose Import or DirectQuery
- MySQL/Oracle: Use appropriate credentials and connection parameters
Example:
- A SQL Server database stores order details. Import the “Orders” table to analyze sales trends.
3. Connecting to Azure Data Sources: Blob Storage, SQL Database
Azure data sources are cloud-based. Power BI can connect to:
- Azure Blob Storage: Load files stored in cloud
- Azure SQL Database: Query live data using DirectQuery
Example:
- A company stores monthly logs in Azure Blob Storage. Power BI reads the CSV files directly for reporting.
4. Connecting to Web APIs and JSON Files
Power BI can consume data from web APIs or JSON files for real-time or external data integration.
- Enter API URL in Power BI
- Use authentication if required
- Parse JSON into tables for reporting
Example:
- Connect to a weather API to get daily temperature data for multiple cities.
5. Connecting to SharePoint Lists/Files
Power BI can access SharePoint Online or On-Premises for lists or files.
- Enter SharePoint URL and select the file or list
- Load it as a dataset
Example:
- Connect to a SharePoint list containing employee attendance records for HR reporting.
6. Connecting to Power BI Datasets
You can reuse existing datasets from Power BI Service:
- Connect to published datasets using “Get Data → Power BI Datasets”
- Ideal for team collaboration and consistent metrics
Example:
- Use a shared “Sales Dataset” to build multiple reports without importing data repeatedly.
7. Import vs DirectQuery
Import Mode:
- Loads data into Power BI
- Fast for calculations
- Data refresh required to update
DirectQuery Mode:
- Queries the source database in real-time
- No data is stored in Power BI
- Best for large datasets or live dashboards
Example:
- Import: Sales data from Excel for monthly reporting
- DirectQuery: Live SQL database of transactions for daily monitoring