Module 2: Connect Power BI to Additional Data Sources
Azure SQL Database
- Need a Azure tenant, subscription, and resource group and then a database and server
- Get the server name, database name, username, and password
- In Power BI Desktop, select Get Data > Azure > Azure SQL Database
- Enter the server and database names, then select DirectQuery or Import
- Enter the username and password, then select Connect
- Select the tables and views to load into Power BI
- Transform and model the data as needed
SharePoint Online List
- In Power BI Desktop, select Get Data > More > Online Services > SharePoint Online List
- Enter the SharePoint site URL (not the list URL)
- Select OK, then sign in with your Microsoft 365 credentials if prompted
- Select the list to load into Power BI
- Transform and model the data as needed Note: You may need to enable the SharePoint Online List connector in Power BI options :(
Sharepoint Document Library
- In Power BI Desktop, select Get Data > More > File > SharePoint Folder
- Enter the SharePoint site URL (not the document library URL) Starts with https:// ;)
- Select OK, then sign in with your Microsoft 365 credentials if prompted
- Select the files to load into Power BI
- Transform and model the data as needed
Connecting to Excel files in SharePoint
- In Power BI Desktop, select Get Data > More > File > SharePoint Folder
- Enter the SharePoint site URL (not the document library URL)
- Select OK, then sign in.
- In the Navigator, select the Excel file to load into Power BI
- Transform and model the data as needed
Connecting to third-party data sources
- In Power BI Desktop, select Get Data > More
- Browse or search for the desired connector (e.g., Salesforce, Google Analytics, etc.)
- Select the connector, then select Connect
- Enter the required connection details (e.g., URL, credentials, API key)
- Select the tables or data to load into Power BI
- Transform and model the data as needed
Connecting to a Dataverse environment
- In Power BI Desktop, select Get Data > More
- Browse or search for the Dataverse connector
- Select the connector, then select Connect
- Enter the required connection details (e.g., environment URL, credentials)
- Select the tables or data to load into Power BI
- Transform and model the data as needed
Connecting to text and CSV Data Sources
- In Power BI Desktop, select Get Data > Text/CSV
- Browse to the location of the text or CSV file, then select Open
- In the preview window, select the delimiter and other options as needed
- Select Load to import the data into Power BI
- Transform and model the data as needed
Connecting to Google Sheets
- In Power BI Desktop, select Get Data > More > Online Services > Google Sheets
- Sign in with your Google account and authorize Power BI to access your Google Sheets
- This gives you a warning that this is a third-party connector and that you should only proceed if you trust the source.
- Select the Google Sheet to load into Power BI
- Sheet1 is the entire sheet, try to select a table or named range if possible.
- Transform the data as needed
Odata Feed
Azure DevOps, Dynamics 365, SharePoint, and many other services expose OData feeds that you can connect to from Power BI. :)
- In Power BI Desktop, select Get Data > More > Other > OData Feed
- Enter the OData feed URL, then select OK
- If prompted, enter your credentials to access the OData feed
- Select the tables or data to load into Power BI
- You may need to select specific URLs and use the OData options to get the data you want.
- Transform and model the data as needed
Additional Ways to get data into Power BI
Entering Data Manually
- In Power BI Desktop, select Home > Enter Data
- In the Create Table dialog, enter the data manually or copy and paste from another source
- Define the column names and data types as needed
- Select Load to import the data into Power BI
- Transform and model the data as needed
TIP: You can also use the Enter Data option to create a table from clipboard data by copying data from another application (e.g., Excel) and then selecting Paste in the Create Table dialog. The only way to edit this data is to edit the advanced query in Power Query.
Using the R programming language
- In Power BI Desktop, select Get Data > More > Other > R Script
- Enter the R script that retrieves or generates the data, then select OK
- If prompted, install the R packages required by the script
- Select the tables or data to load into Power BI
- Transform and model the data as needed
Create a Date Table
- In Power BI Desktop, select Modeling > New Table
- Enter the DAX formula to generate a date table, for example:
DateTable = CALENDAR(MIN(Sales[OrderDate]), MAX(Sales[OrderDate])) - Define the column names and data types as needed - convert to a table, change the data type to date.
- Change the column name to Date.
- Add additional columns for year, month, quarter, etc. using DAX formulas
- Select Close and Apply to import the data into Power BI
- Transform and model the data as needed
Create table of last refreshed date
- In Power BI Desktop, select Modeling > New Table
- Enter the DAX formula to create a table with the last refreshed date, for example:
LastRefreshed = DATATABLE("Last Refreshed", STRING, { {FORMAT(NOW(), "MMMM DD, YYYY HH:MM AM/PM")} }) - Select Close and Apply to import the data into Power BI
- Use this table in your reports to display the last refreshed date
- Use this table in a card visual to show the last refreshed date on your report ALOT.
Creating tables using DAX
- In Power BI Desktop, select Modeling > New Table
- Enter the DAX formula to create a new table based on existing data, for example:
TopCustomers = TOPN(10, Customers, Customers[TotalSales], DESC) - Define the column names and data types as needed
- Select Close and Apply to import the data into Power BI
- Transform and model the data as needed