In part 10 we looked at Power BI dashboards in the extended model-driven Power App for Microsoft Project. If you missed part 10 it can be found here: https://pwmather.wordpress.com/2020/06/22/extending-projectfortheweb-part-10-ppm-cds-msdyn365-powerplatform-msproject-powerbi-powerapps-poweraddict-lesscodemorepower-workmanagement/
In part 11 we look at another example option to add Power BI reports into your model-driven Power Apps, this time on the form filtered to the current record. This wont be a step by step guide as the process is outlined in this Microsoft article: https://docs.microsoft.com/en-us/powerapps/maker/model-driven-apps/embed-powerbi-report-in-system-form. Once completed you will see a Power BI report pre-filtered for the correct record, an example can be seen below:
The blog post assumes you already have a Power BI Report ready to use. Firstly create a new tab where you want the report to be added, I’ve added a Report tab as seen below on my Program entity form:
Then export the solution and open the customizations.xml file in your chosen editor after extracting the zip file. I use Visual Studio Code as my editor. Find the correct form section in the XML, the quickest way is to search the XML file for the Tab name. For my example Report tab I searched the XML for: tab name="Report" – as I only have one tab called Report in the solution, this found the correct section to update. I then followed the Microsoft article I linked to above to update the XML to add in the new Control property details with the Power BI properties as seen below as an example:
As I was filtering for the Program record, the PowerBIFilter XML property, which contains JSON, was set to filter for the Programs table as found in my Power BI report and the programid column in this Power BI table as seen below:
Then to pass in the correct record from the model-driven Power App form to filter the Power BI Report, the PowerBIFilter Alias JSON property was set to the cra2a_programid field from the Program CDS entity the app uses.
The solution files are then zipped up and uploaded using the Power Apps Solutions interface. Once this is completed you will have context filtered Power BI report in the Power Apps model-driven form like below when accessing the IT Change Program:
Accessing the new Report tab displays a prefiltered Power BI report for the IT Change Program:
Accessing the Report tab for a different Program record will automatically filter the Power BI Report for that record.
As this process involves manually editing the solution XML file, ensure that you fully understand the changes being made and fully test this process on a non-production app before making this change on a production app.
That’s it for reporting in this blog series, we’ve finished off with a nice simple way to build a great embedded experience for users using model-driven Power Apps and Power BI. I’ve started the final part of this blog series on extending Project for the web, look out for that soon.