Filter a Power BI report passing parameters through URL
Power BI offers us a very sympathetic way to bring a bit more flexibility into our Reports. It’s not a brand-new feature, but I’m not sure that you know it!
You can display a report and automatically have a page filtered by the parameters you define in the URL.
Why is it cool?
- We can create an embed report and include it on a website/intranet. It’s possible to create a button, or menu to dynamically filter and display our report. (Microsoft provides an example: https://powerbi.microsoft.com/en-us/blog/easily-embed-secure-power-bi-reports-in-your-internal-portals-or-websites/
- It’s also possible to filter a report from a Power Apps
- We can create our own bookmarks (in your browser or in your email)
- We can add filters on fields that are not suggested / available in the Filter Pane
- It’s indeed not a way to add security to your reports!! (Filter can be removed by your users) => The Row-level security is what you need.
- It’s not possible to use it in an iframe with a report “published to web”
First, Microsoft wrote already a nice article on this topic. I suggest you read it for more information.
- Open your report in Power BI Service and go to the page you want to filter
- Click on the address bar and at the end of this line, add the following code ?filter=
Filter on numeric value
?filter=Calendar/Year eq 2022
The first part of this expression refers to the dimension (Table) -> Calendar
The second part refers to the attribute name in this dimension -> Year
eq means equals
Filter multiple numeric values
?filter=Calendar/Year in (2022, 2023)
Filter on a text value
?filter=Product/ProductCategory eq 'Fruit'
Filter multiple Text values
Add Multiple filter on differents attributes
?filter=Customer/Country in ('Belgium', 'Nederland') and Product/ProductCategory eq 'Fruit' and Calendar/Year ge 2021
More operators are available
Like mentioned at the beginning, everything is already well explained on the Microsoft website: https://docs.microsoft.com/en-us/power-bi/collaborate-share/service-url-filters