Blog Post

Power BI Community Blog
2 MIN READ

Set Up Default Filters in Power BI

Pragati11's avatar
Pragati11
Icon for Super User rankSuper User
5 years ago

Have you ever come across a requirement where you need to pre-set some filters on your report to give the users a default view to the report? If yes, then this blog is the right place for you. In this blog, I will be sharing 2 ways on how we can achieve this requirement.

Let us start with the following visualisation:

It is a simple visual showing sales overtime. On the top there are 2 filters: Year and Category.

Now let us give this visual a default view to show only 2 years’ worth of data, i.e., from 2014 to 2016 and only display sales for JACKETS clothing category. We will get the following: (I have highlighted the filter selections for the chart)

From here onwards, we will look at the 2 ways where we can default these filters on the report.

 

Reset to Default Option in Power BI Service

Save the report with the filter selections shown in the previous step and publish it in workspace. When I publish it in the Power BI Service Workspace, I see that my filters are pre-set as I wanted them to be:

Now users can interact with the report and change the filters as they like but also, they can RESET the FILTERS to DEFAULT using the button provided in Power BI Service:

So, this is basically one of the ways we can use to pre-set filters for the users and then the users can further set it to default state. But this approach can be hard for the users who are not used to using a interface in this fashion. To make this easier for the users, we have a 2nd approach to achieve this.

 

Button to Reset Filters in Power BI

Let us start by creating a button in Power BI:

After playing around with some formatting options for the Button we added above, we get the following: (modify it as per your requirement)

Now the next thing is we need to create an action for this button that we created. Before creating an action, we will create a bookmark and save a state for the bookmark. Make sure to have the default filters right on the tab before updating the bookmark. In the below quick video, it is shown how you create a bookmark and then how you update its state.

After the state of the bookmark is updated with the relevant filters on the tab, we assign this bookmark as an action to the Button that we created:

Finally, your button is ready to be used. Just save your report and publish it again to Power BI Service. You can see in the below video, how button has given a better usability to the users to reset to the default state of the report.

The above approach clearly gives a better way from user point of view to reset the filters to the default state.

So, in this blog we looked at two different ways of defaulting the filter selections on the report in Power BI. Button approach seems to be more user friendly.

 

Hope these quick workarounds help everyone.

 

Pragati

Updated 5 years ago
Version 2.0

7 Comments

  • Hi Anonymous ,

     

    Have you tried looking into Relative Date Filter for this?

     

    Thanks,

    Pragati

  • Anonymous's avatar
    Anonymous
    Not applicable

    Pragati11  

    Hi Pragati,

    The above explanation can give a static filter solution. But I need a solution for dynamic filter for example I want to show default filter should be last 15 days. 

    Do you have any idea for this??

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Pragati11 ,

     

    Yes, I have cheked it is fine for last 15 days, What if we want to show data only till yesterday as i have data since 2012 till 2022.

     

    Thanks in Advance.

     

     

  • Hi Anonymous ,

     

    For this you will have to create a workaround in Power BI.

    Consider following table visual. I have maximum date in my data till 31/12/2016.

    Now in this table I want to show data till one day less than 31/12/2016 (maximum date in my dataset). 

    Create a column calculation:

    DateTillYesterdayFlag =
    VAR maxDate =
        MAX ( ClothingSales[Date] )
    VAR prevDaydate = maxDate - 1
    RETURN
        IF ( ClothingSales[Date] <= prevDaydate"YES""NO" )

     

    Now move this column as a filter on your report page and select YES in it. Now you see that the data in the visual is shown till 30/12/2016:

     

    So this is the workaround to achieve your requirement. In your case you will get data till one day less than today, i.e., till yesterday.

     

    Thanks,

    Pragati

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Pragati11 

     

    The solution will be ok if we no need to select any futher filters but i need to select dynamic dates in between.

     

    Lets say I have Advaced Filtering in Power BI filter pane, I want to show default current month(01-10-2021 to 13-10-2021) and user can go historical dates... the selction will be between dates.

     

    Do you have any work around for it?

     

    Regards,

    Rav

  • HI Anonymous ,

     

    Can you kindly add some screenshots here or create a new query for this in the forum?

     

    Thanks,

    Pragati