Power Platform Solution and Power BI – Part 3

Last modified date

In Part 1 we added Power BI to the Power Platform solution and then in Part 2 we added a dashboard. This is post we will embed the report into a form and filter the report to match the context of the form. For this we will use the Accounts form and filter the expenses report to only show the expenses related to one account.

Series

YouTube Version

thumbnail from YouTube

Embed the report into a form.

In my Power Platform solution, the Accounts table has one form included. When I edit the form I can see that I previously added a tab for expenses. On that tab there is an empty section, ready to insert the report.

In the left hand side menu, select components and expand Power BI. Drag and drop Power BI report into the blank section. An pane appears asking lots of questions regarding showing various parts. For now leave all of them as default and click Done. The unfiltered report should appear.

Filtering the embedded report.

The report needs to be filtered to only show the expenses of the selected account. With the report selected you will get the properties pane showing on the right hand side. Expand Components and click on Power BI Report. In the pane that appears, same as before find JSON filter string. You need a JSON string to put in the Static value.

The filter we are going to apply is straight forward match the account id on the form with the account id in the report. We need 3 bits of information

  • Power BI Report table name – Account
  • Power BI Report column name for the account id – AccountID
  • Dataverse logical column name for account id – accountid

You must get the case and of course the spelling right. We then insert these into a json string. The whole string must be on one line, no returns and tabs to make it pretty. Below is an image to explain the parts and below that is the code I used.

image showing Account and AccountID comes from Power BI and accountid comes from Dataverse
{"Filter": "[{\"$schema\":\"basic\",\"target\": {\"table\":\"Account\",\"column\":\"AccountID\"}, \"operator\":\"In\",\"values\":[$a],\"filterType\":1}]", "Alias": {"$a": "accountid"}}

When editing a form in Dataverse, the form is in new record mode so if you have the filter right the report should filter to nothing. When it is working click Done and Save and Publish your form.

Screen grab showing the Edit Power BI report pane and the report filtered to no records showing Blank a few times.

Testing the form

Make sure you test your form. Open your app, open an account and look at the expenses and the report. If your report is a direct query report you should be able to add a new record and the report update.

screen grab of the model driven app in the Power Platform solution showing the expenses tab and the embedded report.

Conclusion

The three posts combined gives us the building blocks to include Power BI in our Power Platform Solutions. I’m hoping more Power BI artefacts such as dataflows also get included in time. There will be future posts, let me know what you want me to do.

Here are the resources I used

About Power BI in Power Apps Solutions – Power BI | Microsoft Learn

Over 20 year experience at being passionate about training, solving problems and loving a new challenge especially in the Microsoft's Power Platform suite.

1 Response

  1. Hi Laura,

    Thanks for the 3-part guide. It is easy to follow.

    Do you know if it is possible to define which page to display from a report for a certain form? I am trying to avoid creating three different reports, but simply switch to another page in the same report based on the form the report is embedded in.

    I have a report which looks slightly different based on whether it is embedded in the account, opportunity or contact form.