Passing Parameters in URL to Filter a Power BI Report

4 Comments
BEFORE WE START, I NEED YOUR HELP.
 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET'S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

 

We have the ability to pass filters to Power BI reports so we can contextually filter the data displayed. This is useful when we are integrating Power BI with 3rd party applications and embedding in web pages where we want to show filtered data. Here are the steps to do this.

First, connect to data. We will use the sample Accounts data here, which can be connected to via the Power BI Web connector.

Rename Table 0 to Accounts:

Next, create a report with visualizations. The visualizations will show unfiltered data, i.e. all accounts, all industries etc:

Now, publish the report to the Power BI Service:

We see the report now in the Power BI Service:

Our report URL is: https://app.powerbi.com/groups/me/reports/02ff8888-a5fd-4dc7-c9dabf5ca0a5/ReportSection.

Now let’s add the filters. To do this, we append to our report URL: ?filter=query/field eq ‘data to filter on’

For example, let’s say we want our report to only show data for AccountId 7. Our query would look like:

https://app.powerbi.com/groups/me/reports/02ff8888-a5fd-4dc7-c9dabf5ca0a5/ReportSection?filter=Accounts/AccountId eq 7

We can see the data on the report has changed, and it has picked up the filter:

Or if we wanted to filter by City = ‘Oklahoma City’, we can do:

https://app.powerbi.com/groups/me/reports/02ff8888-a5fd-4dc7-c9dabf5ca0a5/ReportSection?filter=Accounts/City eq ‘Oklahoma City’

As mentioned, this is useful for embedding scenarios. For more information on operators and data types, check out https://docs.microsoft.com/en-us/power-bi/service-url-filters.

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

4 Responses to Passing Parameters in URL to Filter a Power BI Report

  1. Hi carl, i was able to follow with you until the end, great tutorial. Problem is, the filter applied by the URL is show in the filter pane, in my case i MUST hide this due to information security but i would like to hide only this filter created by the URL since my filter pane contains other business filters.

    I stumbled upon a property that hides the entire filter pane, but i couldn’t find one to hide only this URL filter. Any ideas?

Leave a Reply

Your email address will not be published. Required fields are marked *