It’s no secret that PowerApps and Power BI are related or so you might think considering that both products have the word “power” in their names. Although Microsoft is yet to officially introduce the big picture of how Power BI, Power Apps and Flow will come together, having a shared gateway infrastructure between the three products indicates that we are to see a lot more cross pollination in the future.
Although my blog posts have been heavily focused on Power BI, I have been secretly building up my game in the PowerApps and Flow areas because I believe that the two will be a natural upgrade of what should be in every information worker’s tool box. At some point I will write a dedicated article about where I think things are going in this space as we are starting to integrate workflow, automation and write-back capabilities into our traditional analytics capabilities, but for today I thought I would just write about how one might incorporate PowerApps into a Power BI dashboard.
In this article, I will assume that the reader has some familiarity with PowerApps so I will not be introducing any basic concepts. Let’s say that you have a PowerApp that you have developed and you would like to embed it into Power BI. Today, there is no native way to accomplish it, meaning that neither PowerApps nor Power BI design experiences are aware of each other; therefore, we will have to link the two up by writing some script logic.
With respect to embedding one product within another, I can see two interesting use cases. First, and the most obvious one at least to me, is being able to embed Power BI charts within PowerApps. PowerApps today has some very basic charting capability, but not nearly as sophisticated as Power BI. Unfortunately, this embed scenario is not yet available. Second, is embedding PowerApps within Power BI. This use case may not seem quite as interesting at first, but if you consider a situation where we are trying to implement “What-If” functionality, you could see how this capability could become handy.
In my example, I wanted to build a driver-based model in Power BI that would require various practice heads in a professional services organization forecast their average rate and headcount for the next year so that the company could estimate the next year revenue. So,my Power BI model used a direct query to access an Azure SQL database which allows the users to see the aggregated information in near real time as the forecasts are being submitted. Then, I wrote a PowerApp that the practice managers would use to submit their forecasts. Theoretically, that’s all I had to do to support this scenario, but I decided that it would be pretty cool to have the two experiences integrated into a single interface so I decided to embed PowerApps into a Power BI dashboard.
As you can see from the image above that I have my app running in the bottom tile and I have my analytical tiles at the top. Theoretically, as forecasts roll in, the top tiles will get updated. The way I did the embedding is the following:
- Go to powerapps.com and sign in
- Click on the Apps icon to get a list of your PowerApps
Find the PowerApp you would like to embed and click on Open
This will launch your app in the browser. Select the URL from the app, it will look like something like this
- Copy that entire URL into your clipboard
- Go to the Power BI dashboard that you would like to embed your PowerApp into
- Click on Add Tile->Web content
- Create an IFrame tag and paste your PowerApps URL as the SRC and you are done
Your Web Content script should look something like this
<iframe width=700 height=330 src=”YOUR URL HERE” /iframe>
Couple of things to be aware of… today, there is no way to trigger dashboard/data source refresh in Power BI programmatically, which means that when users submit their forecasts the dashboard tiles will refresh at frequency set up at the data source level (I recommend to set it to 15 minutes – the lowest level). The way to get the updates as soon as possible is to go to the report view in Power BI and then hit Refresh.