Welcome to another edition of #24DaysPowerPlatform!
In this post I would like to give you an overview about the Power BI and PowerApps integration. As you maybe already know, Power BI supports the mechanism of custom visual which allow report developers to add visual not shipped with Power BI to their reports. The list of custom visuals is growing and growing. Those visuals are developed by community developers, companies and also Microsoft adds custom visuals to the Power BI Visuals marketplace.
One of those custom visuals is the PowerApps custom visual which allows you to embed a PowerApp into a Power BI report and/or dashboard.
Example: Show Article Details in a PowerApp integrated in a Power BI report
Let’s start with an example report that contains sales information. The sales table itself contains the following fields:
The report looks like this:
What I want to to add now is a PowerApps that displays additional Article information (stored in an Azure SQL Database table).
Add the PowerApps visual
Configure the visual
Whenever you add a new PowerApps custom visual to your report canvas it needs at least one mapped data field – otherwise it will render as an empty visual.
Although you can add the PowerApps custom visual either in Power BI Desktop OR the Power BI Service – only in the Power BI Service you are able to create a new PowerApp with the report.
Create a new PowerApps (Power BI Integration)
After publishing the report to PowerBI.com, the visual content looks like this:
You can choose in which environment the new PowerApp will be created. In my demo, I’ll use the option “Create new”. A new browser window with the PowerApps Studio opens.
When creating a new PowerApp using the Power BI integration, you get an additional data source – PowerBIIntegration that serves as the connection to the Power BI report. Whenever a filtering action occurs in the Power BI report, this information is available in this property.
During the PowerApps creation action I selected the action to add a new form which in the next step needs to get a connection to the Article table (which holds the additional article details).
Create a new data source – In my case it is a connection to a Azure SQL Database.
Select the table you want to connect to.
In the next step, select the fields you want to display in your PowerApp form.
The result looks like this:
On IMPORTANT step is missing. The object PowerBIIntegration can contain a list of mapped Articlenames (in my example). The form itself can only display ONE item at a time. What needs to be done now, is to filter the Item property of the form to display the first selected entry and only show those pieces of information.
This filtering is done by setting the ITEM property of the form and assigning the formula:
This formula combines the data source from the PowerApp ([dbo].[Article]) with the PowerBIIntegration object. The first entry in this object is used for the filtering.
Save and Share the PowerApp
Before the PowerApp can be used in Power BI it needs to be saved and shared.
After this step you can switch to the PowerBI window and you can test the PowerApps integration in action.
First test case: no article selected – the first entry (alphabetical order) is selected.
If you select another article, the filter information is passed to the PowerApps visual and inside that the PowerBIIntegration object is used to set/filter the Item property of the Form.
With that, one of my first examples of the Power Platform in action is done!
I hope you enjoyed the sample!
This post is part of my 24DaysOfPowerPlatform blog series. Have a look at the other blog posts as well..