Forum Discussion

arielcedola's avatar
arielcedola
Icon for Helper III rankHelper III
6 years ago
Solved

How to set default value for slicer but enabling multiple slicer selection

Hi,

I'm using RANKX to set a default value to a filter in several visuals, as follows:

YearRank = RANKX(ALLSELECTED(Sales[Year]), CALCULATE(MIN(Sales[Year])),,DESC,Dense)

I set the current year (top ranked year in the ranking) as the default year in each visual by applying the Top N filter type as follows:

In this way I see only the records for the current year when I come to the report, which is the effect I was looking for. Therefore with the slicer I can easily see the records for the previous years, but if I want to see records for 2 or 3 years together, through a multiple selection in the slicer, obviously using this method it's not possible.

How could I set the by default visualization of the records for the current year, but having still the chance to select multiple years to visualize?

 

Here the link to the pbix file.

https://drive.google.com/file/d/1Z3JizbdKVR4XV98K0zdFopTCAWULumdH/view?usp=sharing

 

Thanks.

8 Replies

  • Allow your report users to modify filters, and teach them how to change that particular one.

  • arielcedola , Not sure it will help. But you can have slicer like this

     

    Create a column like this in your date table

    Month Type = Switch( True(),
    year([Date]) = year(Today())-1,"Last Year" ,
    year([Date])= year(Today()),"This Year" ,
    Format([Date],"YYYY")
    )

     

    Now you save with "this year", so when you come to the page it will be the latest year.  And change it also.

    • arielcedola's avatar
      arielcedola
      Icon for Helper III rankHelper III

      Hi mwegener 

       

      not yet. In another post Anonymous suggested me to use ISFILTERED() DAX function to know if the column is being filtered with the slicer. Only when it returns false I should set the default value for the year, it's clear. The point is that I'm not sure how to use this conditional instead of the previously used ranking to filter a table or a viz. Any suggestion?

      Thanks 😉