Embed PowerApps into Power BI Desktop

 

Microsoft’s January 2018 Power BI Desktop update (blog found here) contains quite a few small visualisation features, but the one that stood out most to me is the ability to import PowerApps as a Custom Visual. My last two blogs (Part 1 and Part 2) demonstrated how to embed a PowerApp into a Power BI Dashboard in the service, but it wasn’t possible to achieve this in Power BI Desktop or a Report.  How things have changed within a month!

This article illustrates how quick and easy it now is to plug an existing PowerApp into Power BI Desktop.     

PowerApps Custom Visual

Like all popular Custom Visuals, you can either Import from file (stored on a local machine) or Import from store. The Microsoft endorsed Custom Visuals are found in the store, which is why I would generally advise importing visuals from there.  Search for “PowerApps” and it will appear as the top result.

clip_image002

Click ‘Add’ and the PowerApps Custom Visual is available.

clip_image004

NOTE:   The PowerApps Custom Visual is currently in Preview, meaning its reliability cannot be 100% guaranteed.  Always use Preview tools/features/visuals with caution.

PowerApp Connection

I previously created an ‘SvT Adfjusted’ PowerApp, which will be used for this example.   Firstly, the visual needs to have ‘data’.  It can be an attribute or measure, but doesn’t matter when connecting to an existing PowerApp.  If you haven’t logged into the PowerApps portal, you may be promoted to do so with Power BI Desktop.  Once logged in, you will see the below screen:

clip_image006

 If you see the ‘not supported’ error message above, do not worry – this is red herring.  Click ‘OK’ and then navigate to the appropriate Environment within the nested PowerApps portal.  ‘Adjust Target App’ resides in the ‘Callums Blog’ Environment.

clip_image008

Click ‘Choose App’, select the PowerApp and click ‘Add’.

clip_image010

That’s it, the PowerApp is now embedded and ready to use in Power BI Desktop.

clip_image012
It is also possible to create a new PowerApp within Power BI Desktop, which is demonstrated in this video. The look, feel and general experience is the same as what you see in the PowerApps portal, meaning you do not even need to use a web browser to get started.

PowerApps Refresh

I wander how long Power BI Desktop takes to refresh when a change is made to the embedded PowerApp?  Let’s find out.

Before:

clip_image014

Principal A ‘Target’ value is changed from 850000 to 950000.

clip_image016 

Unfortunately, nothing happens.  Power BI Desktop caches the data sourced from the Azure SQL Database, which is where the PowerApp data is stored.  The only ways to view the change is to click the Power BI ‘Refresh’ button or change the context of the visual interaction within a report.  What I mean by the latter is that you need to force the Tabular engine to write a new DAX query, which in turn, forces a query refresh.  Using the ‘Refresh’ button (below) will always be the simplest refresh method.  

clip_image017

After:

clip_image019

Published Report

The report can now be published to the Power BI Service.

clip_image021

The Service contains the same refresh issues as described in Power BI Desktop. Manually refreshing the web page (CTRL-F5) is currently the best approach.  It is worth noting there is between 15-30 seconds delay between a submitting a PowerApp change and viewing the new number in a visual.  This is expected, as there are a few processes (behind the scenes) that must happen first.

Web Content vs. Custom Visual

There are now two ways of adding a PowerApp into the Power BI Service – but which is better?

Web Content

          Advantages

o   Easy to dynamically add a ‘Web Content’ tile to a Dashboard.

o   More flexibility around the link behavior e.g. open custom link or other report in a new tab.

o   The PowerApp sits completely outside of Power BI and does not necessarily need to be seen in a report.

          Disadvantages

o   PowerApp embed code is required and may not be available to all users.

o   Extra layer of management and maintenance.

Custom Visual

          Advantages

o   No increase in the Power BI Desktop data model or file size.  The PowerApp is sourced from the cloud and acts as a Live Connection.

o   One stop shop where both visuals and the PowerApp reside.

o   Less places for an issue to occur.  Security can also be resolved, using Power BI Desktop as a test.

o   PowerApp can be pinned as a visual – to an existing or new Dashboard.  This step is far more user friendly and easier to achieve with the Custom Visual.

          Disadvantages

o   No ability to use custom links.

Whilst Web Content does offer a bit more flexibility and interactivity, I would advise using the Custom Visual wherever possible.  Having one place where everything is managed, makes everyone’s lives far easier.  If you have a good business case for adopting Web Content, then of course, please do so. 

References

Find other recommended resources below.

o   PowerApps Custom Visual Video – http://bit.ly/2Fi3vLY

o   Power BI January Update – http://bit.ly/2CSfLVl

o   PowerApps – http://bit.ly/2Brjys4

o   Flow http://bit.ly/2CoL2vW

o   Common Data Service – http://bit.ly/2CnXXhv

Contact Me

If you have any questions or want to share your experiences with the PowerApps Custom Visual, feel free to leave a comment below.

Twitter:                @DataVizWhizz