Embed PowerBI in PowerApps-Part 2
Embed PowerBI with PowerApps in a model driven app
1) Before we start embedding Power BI with PowerApps reports in model driven applications, we must first make sure to enable Power BI Visualizations in the organization
Step by step instructions to enable provided here
2) Next, we need to export the solution where we intend to embed PowerBI
Step by step instructions to export provided here
3) Once you have exported the solution, open the customizations.xml file that is available in the zipped solution, either in an XML editor or a text editor
4) Find the block of the form XML you are looking to embed, and add the below section (credit: Microsoft)
<section id="{d411658c-7450-e1e3-bc80-07021a04bcc2}" locklevel="0" showlabel="true" IsUserDefined="0" name="tab_4_section_1" labelwidth="115" columns="1" layout="varwidth" showbar="false">
<labels>
<label languagecode="1033" description="My unfiltered Power BI embedding demo"/>
</labels>
<rows>
<row>
<cell id="{7d18b61c-c588-136c-aee7-03e5e74a09a1}" showlabel="true" rowspan="20" colspan="1" auto="false">
<labels>
<label languagecode="1033" description="My Report"/>
</labels>
<control id="unfilteredreport" classid="{8C54228C-1B25-4909-A12A-F2B968BB0D62}">
<parameters>
<PowerBIGroupId>00000000-0000-0000-0000-000000000000</PowerBIGroupId>
<PowerBIReportId>544c4162-6773-4944-900c-abfd075f6081</PowerBIReportId>
<TileUrl>https://xyz.powerbi.com/reportEmbed?reportId=544c4162-6773-4944-900c-abfd075f6081</TileUrl>
</parameters>
</control>
</cell>
</row>
<row/>
</rows>
</section>
5) In the above section, feel free to change the labels as you feel appropriate.
6) You should also change PowerBIGroupID, PowerBIReportID and TitleURL values to the PowerBI report you want to embed.
7) You can get the details from clicking on File/Embed menu item in PowerBI.com and copying the link from PowerBI.com
8) Make sure to copy the exact ID’s needed from the link, it contains GroupID and ReportID along with a few additional pieces of information. The titleurl element should only contain the reportID part as shown in the sample code snippet in step 4
9) Now save the customizations.xml file and it is ready to be imported back into PowerApps
10) Step by Step instructions on update and import of a solutions detailed here
11) Now you can browse to your app and see that the report is embedded in whichever section you inserted the piece of code, in my sample I inserted into the main section of the Information Form, see below.
12) Once the report shows up, you can edit the model driven app, edit the form in the model driven form editor and change the PowerBI properties as per your need. As you can see, once PowerBI is embedded manually, it is easier to pull it up and change it as needed through the form editor
13) You can take this further by adding contextual filters to the current model driven form.
14) Since this is a feature still being matured, there a few known issues and limitations, details here.
15) Along with the listed in the link above, if you run into issues also check the below
a. Make sure the model driven app solution and the enabling of PowerBI visualizations in the organization are on the same environment in the same tenant, it is key
b. Make sure you have access to the environment
c. If you are new to XML editing, make sure to verify if the customizations.xml is well formatted by opening in a browser, if it opens as below you are in good shape, if not, do not import the solution to PowerApps until it is fixed