In previous articles we started talking about the importance of integrating Power BI reports with the Power Platform, while we looked at the integration with Power Automate. This time we will explore how to integrate the Power BI report in an internal portal or website, by leveraging the Website or portal option, which allows you to generate a simple embed URL.
NOTE
We will look at how to perform an URL embedding rather than a full-fledged embedding solution that provides more control and customizations, like an actual solution done through the Power BI Developer Playground.
We aim to generate an embed URL, adding some additional parameters and see how we could use external inputs to filter the report while rendering it. This shows us that from an UX perspective, we could use such a method to avoid people navigating away from the context they were working in (e.g. an application, a portal etc.). Is it not annoying when you click on a button or link, and this opens a completely new tab?!
We are going to choose the "efficient, not lazy" method, so we will open the desired report in the Power BI Service. Afterwards we will choose:
File ➡️ Embed report ➡️ Website or portal
Unless you work with a developer that will add an iFrame, we are just going to copy the first link generated.
Now let's look at the code snippet we just copied:
https://app.powerbi.com/reportEmbed?
reportId=7ba5f9d1-75be-4016-911a-e077550004da&
autoAuth=true&
ctid=6ec206e4-1f91-4038-8cba-1481a39e5dc0&
Let's understand what the used parameters mean:
Let's perform a test. I am just going to use the link and open the report in a web browser.
Considering that we are not in the Power BI Service context, this will just open the report. However, there are some aspects that I do not like:
Now this is the part where additional parameters will come to our rescue. These parameters are powerful tools for customizing the user experience and controlling how reports are presented and interacted with, especially in embedded scenarios.
This parameter controls the visibility of the navigation pane which includes report pages. When set to false, the navigation pane is hidden, allowing for a cleaner view of the report. If set to true or omitted, the navigation pane will be visible, allowing users to navigate between different report pages.
URL Example:
1https://app.powerbi.com/reportEmbed?
2reportId=7ba5f9d1-75be-4016-911a-e077550004da&
3autoAuth=true&
4ctid=6ec206e4-1f91-4038-8cba-1481a39e5dc0&
5navContentPaneEnabled=false
Let's try it out:
This parameter determines whether the filter pane is visible to the user. If set to false, the filter pane is hidden, preventing users from altering filters directly from the filter pane. This is useful when you want to enforce certain filters without giving users the option to change them. Setting it to true or omitting it, makes the filter pane visible, allowing users to interact with and adjust filters.
URL Example:
https://app.powerbi.com/reportEmbed?
reportId=7ba5f9d1-75be-4016-911a-e077550004da&
autoAuth=true&
ctid=6ec206e4-1f91-4038-8cba-1481a39e5dc0&
navContentPaneEnabled=false&
filterPaneEnabled=false
Let's try it out:
The groupId parameter refers to the workspace (or group) where the Power BI report is located. This is especially relevant when embedding reports from different workspaces. It ensures that the report is accessed within the correct workspace context.
URL Example:
https://app.powerbi.com/reportEmbed?
reportId=7ba5f9d1-75be-4016-911a-e077550004da&
autoAuth=true&
ctid=6ec206e4-1f91-4038-8cba-1481a39e5dc0&
groupId=ffb44bc1-90cd-47d8-835a-b93ed7666fe7&
navContentPaneEnabled=false&
filterPaneEnabled=false
NOTE
Getting the Workspace ID can be easily done from the Power Service, as it will be the first parameter when accessing the workspace.
This parameter specifies the report page to display when the report is launched. It is especially useful for reports with multiple pages, as you can direct users to a specific page by default. The value for this parameter typically follows the format ReportSection<GUID>. The easiest way to identify the report page GUID is from the Power BI Service, when navigating to the respective page. The GUID will appear right after the report GUID.
URL Example:
https://app.powerbi.com/reportEmbed?
reportId=7ba5f9d1-75be-4016-911a-e077550004da&
autoAuth=true&
ctid=6ec206e4-1f91-4038-8cba-1481a39e5dc0&
groupId=ffb44bc1-90cd-47d8-835a-b93ed7666fe7&
navContentPaneEnabled=false&
filterPaneEnabled=false&
pageName=ReportSectionbdcc727efec3d964ed1e
NOTE
If this parameter is omitted, the report will render with the active page from when the report was last edited/published.
Let's try it out:
The filter parameter enables you to apply filters to the report via the URL. This is useful for dynamically altering the data displayed based on the context in which the report is being viewed. The syntax generally follows the format filter=Table/Field eq 'Value', and you can combine multiple filters using logical operators like and, or, in etc.
The syntax generally follows the format filter=Table/Field eq 'Value'. Let's look at an example:
Now there are some aspects to be kept in mind:
For setting up the filters, we would first need to understand the OData operators that we can use. While OData has a broad range of operators, we will limit ourselves to 8 possible operators. For Power Automate developers these will sound familiar.
An important aspect to be factored in is the actual data type of the column. There are 3 different data types that we talk about which are String, Number and Date. Depending on the data type, the structure of the supplied filter value will change.
NOTE
In this Microsoft Learn section, you can read more details into this topic.
When using special characters in table or column names within Power BI URL filters, they need to be encoded using a specific format. This involves prefixing the special character with an underscore, followed by "x", the four-digit Unicode, and another underscore. For example, a space would be encoded as x0020.
When using special characters in values most special characters are supported, but some might still require encoding.
When using URLs with special characters like a space for example (similarly to how we did this above in the operator table), those characters will be replaced automatically by the browser, however you could still follow a best practice to encode the full URL directly.
NOTE
You can find in this W3 documentation a complete list of escape characters used for encoding, but also more information about encoding in general.
Integrating Power BI reports directly into your internal portal or website not only enhances user experience but also streamlines access to crucial data. By leveraging embed URLs with customized parameters, you can keep your users engaged and focused within their workflow. Stay tuned for more insights on optimizing your Power BI solutions, and start embedding your reports today for a more seamless data experience!