This repository is a companion repository of demonstrations that support the presentation Power BI Incremental Refresh and Hybrid Tables. In this repository you'll find:
- SQL Scripts to recreate the AdventureWorksDW Database
- SQL Scripts to alter the AdventureWorksDW Database for usage with the Power BI concepts of Incremental Refresh and Hybrid Tables.
- Power BI Templates with prebuilt models and reports inllustrating these features.
- Instructions on how to deploy this in your own environment.
This solution is built upon a combination of Power BI and Azure SQL Database therefore to leverage the code you must have access to the following:
- A Power BI Pro Subscription (Note: if you do not currently have Power BI Pro you can sign up for a 60 day trial).
- Access to an Azure Subscription where you can create an Azure SQL Database.
- A machine with Power BI Desktop to open, configure, and deploy the models.
In this section we'll setup the Azure SQL Database.
-
Navigate to the Azure Portal and login.
-
Select "Create a resource".
-
In the search box type "sql azure" and press enter.
-
Click "Create" for the Azure SQL Resource.
-
Select the Resource Type "Single database" and click "Create"
-
Enter and make note of the properties for:
- Resource Group
- Database Name
- Server
- Password
-
Click "Review and Create".
-
Click "Create".
-
You'll be presented with a progress screen.
-
Once the databse is done provisioning click "Go to Resource".
-
By default databases are not externally accessible. Click "Set server firewall" to change access settings.
-
Choose "Selected Networks"
-
Click "Add your client IPv4 address..."
-
Check "Allow Azure services and resource to access this server".
-
Click "Save".
-
Navigate to the query editor.
-
Provide your login credentials and click "OK".
-
Copy the contents of 01 - Create AdventureWorksDW.sql from the scripts folder and click "Run".
-
Repeat the last step for scripts 02 - Populate dimDate.sql, 03 - Shift FactInternetSalesDates.sql, 04 - Cleanup Orders.sql paying close attention to the instructions for the dates. (Note: the script in its current form should work fine through the end of 2023, but will need attention in 2024).
Now that the databse is properly configured, you can setup the Power BI Components.
- Navigate to Power BI and login.
- Create a new workspace.
-
Open PowerBIIncrementalRefresh.pbit.
-
When prompted to provide data be sure to enter the ServerName and Database name that you used when configuring the sql server, and click "Load".
-
You must also provide RangeStart and RangeEnd values. Good values for this are 1/1/2021 and 1/1/2022 respectively.
-
When promped enter your databse username and password and click "Connect".
-
Data will now import from the source database.
-
Once the data has loaded successfully, click "Transform Data" to setup a custom filter for incremental refresh.
-
Find the FactInternetSales table's OrderDate column and add a custom filter.
-
Set the filter to be "is after or equal to" the parameter "RangeStart" and "is before" the parameter "RangeEnd" and click "OK".
-
Now that the range filter is applied, right click on "FactInternetSales" and select "Incremental Refresh".
-
Setup an incremental refresh policy and click "Apply".
-
Click deploy, and deploy the configured report to the Power BI workspace.