Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I’m trying to get a URL to filter a report with a certain criteria and I’m having a difficult time with it. I know it’s done through query parameters, and I’ve looked through the documentation here: https://docs.microsoft.com/en-us/power-bi/collaborate-share/service-url-filters
The issue I’m having is that I’m able to build a URL with query parameters if it’s a numeric field, but it’s not working if it’s a text field.
My table name is “TaskLog” and I have a “TaskNumber” field that is numeric field and a “City” field that is a text field.
The following query parameter correctly filters the “TaskNumber” field:
?filter=TaskLog/TaskNumber eq 1521
However, the following query parameter on the "City" field doesn’t work:
?filter=TaskLog/City eq ‘Hamilton’
I've tried to test other tables and columns and everytime I can get the URL query parameters to work for numeric fields but never for text fields. Any ideas on why my text field filter is not working?
Thanks!
Solved! Go to Solution.
Hi @v-janeyg-msft,
I figured out the issue!!
I first checked the other items you asked me to check (other reports, making sure the city field is text, etc.) and I couldn’t find any issues with that. Then I thought it might be an issue with my quote (since all the numeric fields that don’t require a quote works). And indeed it was!
I copied 'manager name' directly from the website documentation and it filtered!
Then I realized what my issue was! To make it easier to type the URL, I was first typing it in a Microsoft Word document and then coping and pasting the URL in the browser. But what was happening was that Microsoft Word by default changes “straight quotes” to “smart quotes”.
Notice how in the former the quote curves around the word while in the latter it’s a straight quote.
After I realized this, I changed it to use straight quotes, so now it works!
Thanks so much for your help on this!!! I really appreciate it! 🙂
Hi, @Lierreyy
I tested it in my machine, and the text type data can be filtered normally.
In theory, if the filter is successful, there will be corresponding changes on the filter pane, you can see if it has changed.
It won't work if the following conditions exist:
Thanks so much for looking into this @v-janeyg-msft! 🙂
It is very strange why it doesn't work for me. The conditions you pointed out are not an issue in my report.
When I put ?filter=TaskLog/TaskNumber eq 1521 as the query filter it properly filters and shows on the filter pane:
When I put ?filter=TaskLog/City eq ‘Hamilton’ as the query filter, the filter pane doesn't have the city and the table data are not filtered (the picture below shows only city of Hamilton but that's because this is test data ... but the data isn't being filtered):
Just to check if there was any issue with my field name I also tried this: ?filter=TaskLog/City eq 4
City is a text field, so this filter is obviously not valid, but with this, I actually get city added to the filter pane (though nothing is of course filtered) so there is nothing wrong with the table or field name:
Anyways, I created a work around for this by creating a different table with City and a City ID and added the numeric City ID to the url filter and it worked. Obviously that shouln't need to be done since text field filtering should work, but it's a workaround to deal with my immidiate issue. If I ever figure out what's causing this, I'll post a response here.
Hi, @Lierreyy
I tested again on both edge and chrome browsers without any issues. So it shouldn't be a bug.
The problem should be with your report. You can arbitrarily test other reports on your pbi service to see if the text field can be properly filtered.
Secondly, please re-publish the report, or check whether there are RLS and other permission restrictions in the report. Check if your city field type is text.
What is your data source? Have you updated your desktop version to the latest?
If possible, please share some unsensitive data to help us clarify your scenario.
Hi @v-janeyg-msft,
I figured out the issue!!
I first checked the other items you asked me to check (other reports, making sure the city field is text, etc.) and I couldn’t find any issues with that. Then I thought it might be an issue with my quote (since all the numeric fields that don’t require a quote works). And indeed it was!
I copied 'manager name' directly from the website documentation and it filtered!
Then I realized what my issue was! To make it easier to type the URL, I was first typing it in a Microsoft Word document and then coping and pasting the URL in the browser. But what was happening was that Microsoft Word by default changes “straight quotes” to “smart quotes”.
Notice how in the former the quote curves around the word while in the latter it’s a straight quote.
After I realized this, I changed it to use straight quotes, so now it works!
Thanks so much for your help on this!!! I really appreciate it! 🙂
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.