Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Lierreyy
Helper I
Helper I

Power BI Report URL Query Parameter for Text Field

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!

1 ACCEPTED 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!

Documentation.png

 

Manager Name.png

 

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”.

 

Filter Criteria.JPG

 

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!

Hamilton.png

 

 

Thanks so much for your help on this!!! I really appreciate it! 🙂

View solution in original post

4 REPLIES 4
v-janeyg-msft
Community Support
Community Support

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. 

vjaneygmsft_0-1642735590246.png

It won't work if the following conditions exist:

vjaneygmsft_1-1642735779586.png

Did I answer your question? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.
 
Best Regards,
Community Support Team _ Janey

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:

Task Number.png

 

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):

City.png

 

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:

City as a Number.png

 

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.

vjaneygmsft_0-1643011390224.png

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.

 

Did I answer your question? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.
 
Best Regards,
Community Support Team _ Janey

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!

Documentation.png

 

Manager Name.png

 

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”.

 

Filter Criteria.JPG

 

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!

Hamilton.png

 

 

Thanks so much for your help on this!!! I really appreciate it! 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors