Embedded Canvas Apps

Changes in Power BI data & Power Apps

An illustration of Power Apps inside a Power BI report
Power BI & Power Apps (src: Microsoft Docs)

I recently got involved in a Power Apps project where I had to embed a canvas app inside a Power BI report.

At a high level, the steps are as follows (detailed instructions provided here):

  • Add the Power Apps visual to your report
  • Select the data fields that you want to associate with it
  • Choose an existing app or select an environment to create a new one
  • Verify that a new object – PowerBIIntegration is added to the app
  • This object passes data selected in the report to the app

As a user selects or filters data in Power BI, PowerBIIntegration object will pass the filtered/selected data back to the app.

What if you want to initiate or trigger certain actions when the data passed by the PowerBIIntegration object changes? The simplest method I could come up with is by using a combo box control.

The example I am using for this illustration is a fun one! Consider there is a table of food items in a Power BI report. Some of the food items are healthy and some are not. There is also a Super Mario visual within the Power App. The idea is to have Mario stop and start when the selected food item(s) in the report change.

To achieve this, add a combo box control. Connect the app to the same data source that populates the Power BI report. In this case, it is a simple table in an excel spreadsheet. Set the Items property of the combo box to this data source. Set the DefaulSelectedItems property of the combo box control to PowerBIIntegration.Data.

When the data in the Power BI report changes, PowerBIIntegration.Data will change. Since this populates the selected items of the combo box, the combo box selected items change. This in turn triggers the OnChange property of the combo box. In this example, I have a timer whose start property is controlled by a variable. The OnChange of the combo box toggles the value of this variable.

When the value of the combo box’s selection changes for the first time, it will start the timer and will make Mario move. When this happens again, it will stop the timer and Mario both. And this process is repeated. To illustrate this behavior, I first select one of the healthy food items followed by an unhealthy one. The reason for that is to make this visual fun to illustrate a point to the kids that healthy food items help you move towards a good life!

Let me know if there is another way to use changes in a Power BI report as a trigger within an embedded Power Apps app!

 

To learn more about Power Apps embedded in a model-driven app, check this post.

2 thoughts on “Changes in Power BI data & Power Apps”

Leave a Reply