When you open a report in Power BI service, each page of the report has its own unique URL. To filter that report page, you could use the Filters pane on the report canvas. Or you could add query string parameters to the URL to filter the report. Perhaps you have a report you'd like to show colleagues and you want to pre-filter it for them. One way to do this is to start with the default URL for the report, add the filter parameters to the URL, and then email them the entire URL.
The syntax is fairly straightforward; start with the report URL, add a question mark, and then add your filter syntax.
URL?filter=Table/Field eq 'value'
If it's still confusing, continue reading and we'll break it down.
Let’s assume that the URL to our report is the following.
And we see in our map visualization (above) that we have stores in North Carolina.
Note: This example is based on the Retail Analysis sample.
To filter the report to show data only for stores in "NC" (North Carolina), append the URL with the following;
?filter=Store/Territory eq 'NC'
Note: NC is a value stored in the Territory field of the Store table.
Our report is filtered for North Carolina; all the visualizations on the report page show data for only North Carolina.
By default, you can only filter on a single field with the query string. But you may have situations where you want to filter on multiple fields. One way to do this is by creating a calculated column that concatenates two fields to a single value. Then you can filter on that value.
For example, we have two fields: Territory and Chain. In Power BI Desktop, create a new Calculated column (Field) called TerritoryChain. Remember that the Field name cannot have any spaces. Here is the DAX formula for that column.
TerritoryChain = [Territory] & " - " & [Chain]
Publish the report to Power BI service and then use the URL query string to filter to display data for only Lindseys stores in NC.
https://app.powerbi.com/groups/me/reports/8d6e300b-696f-498e-b611-41ae03366851/ReportSection3?filter=Store/TerritoryChain eq 'NC–Lindseys'
Once you've filtered the report using query string parameters, you can pin visualizations from that report to your dashboard. The tile on the dashboard will display the filtered data and selecting that dashboard tile will open the report that was used to create it. However, the filtering you did using the URL is not saved with the report and when the dashboard tile is selected, the report opens in its unfiltered state. This means that the data displayed in the dashboard tile will not match the data displayed in the report visualization.
There may be some cases where this will be helpful when you'd like to see different results; filtered on the dashboard and unfiltered in the report.
There are a couple of things to be aware of when using the query string parameters. - Query string filtering does not work with Publish to web URLs.
Field type has to be string.
Table and field names cannot have any spaces.
More questions? Try the Power BI Community