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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Millstone1998
Frequent Visitor

Retrieving the current page filters

Hi,

If I pass a filter to a report in a URL it becomes a page filter.  Is there any way to retrieve that filter condition when there are no rows matching the condition?  As there are no rows I can't use SELECTEDVALUE() and I can't see anything else I could use.  I understand that this would be complex as the condition could be equals, not equals, etc. 

This isn't my example, but a trivial example might be a web site where someone enters their search term "tomato" which is passed as a filter to the URL and the report would not contain any tomato data so could show a message "sorry, tomato not found".  In my case I can't ensure that the value passed is always present in the data.

Many thanks.

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

I don't think that this will be possible because of the way filters work. Even if you specify the condition as a boolean, filters are always tables of values which already exist in the data. For example, if you specify 'Table'[Column] < 5 as a condition, that might be translated into a list like { 0, 1, 2, 3, 4 }. But if you don't have any entries where the value is 3 then the list would be { 0, 1, 2, 4 }.

Given that, if you try to use as a filter a value which doesn't exist in your data then Power BI will basically just throw that value away.

Having said that, you might be able to detect the fact that a missing value was passed in, even if you can't detect what the value was. You could create a measure like

Missing value used as filter =
IF (
    ISFILTERED ( 'Table'[Column] ) && ISEMPTY ( FILTERS ( 'Table'[Column] ) ),
    1
)

This checks that there is a filter applied to the column, but the values or condition applied don't match any of the existing data.

View solution in original post

1 REPLY 1
johnt75
Super User
Super User

I don't think that this will be possible because of the way filters work. Even if you specify the condition as a boolean, filters are always tables of values which already exist in the data. For example, if you specify 'Table'[Column] < 5 as a condition, that might be translated into a list like { 0, 1, 2, 3, 4 }. But if you don't have any entries where the value is 3 then the list would be { 0, 1, 2, 4 }.

Given that, if you try to use as a filter a value which doesn't exist in your data then Power BI will basically just throw that value away.

Having said that, you might be able to detect the fact that a missing value was passed in, even if you can't detect what the value was. You could create a measure like

Missing value used as filter =
IF (
    ISFILTERED ( 'Table'[Column] ) && ISEMPTY ( FILTERS ( 'Table'[Column] ) ),
    1
)

This checks that there is a filter applied to the column, but the values or condition applied don't match any of the existing data.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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