Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

"Current year" as default value for year slicer hack?

I know this is not supported yet but I'd like to ask if someone knows any workaround...

 

I've thought about a couple of things:

 

  • Having every value displayed in the report as a measure like this: IF ( ISFILTERED ( yearColumn ), measure, CALCULATE (measure, FILTER (current year))) So, by default, every measure would be filtered by the current year except if you select the year filter. This is time consuming (especially if you have to modify tens of reports), unintuitive for the end user and not always possible.
  • Two slicers, one (selected) with only one option (the current year) and another one with all the years. Also not very intuitive nor pretty.

The required functionality is: always load the report filtered by the current year and still have a easy way to change between years (like, with a simple slicer).

 

Any ideas?? :robotmad:

 

Also, keep voting!

10 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello,

    You can select the current year in the slicer and save,publish the report, which acts as default value.

    The user will have the ability to filter other years if they want to. 

     

    If you have any other calculations to be performed based on the selection. You can use the "SELECTEDVALUE" function in the measure which brings the Current year(in dafulat case)/the user selected value in all other cases.

     

    Hope this helps.

    Let me know if you have any questions.

     

    Thanks,

    Soumya

  • You could also go the way of performing the logic in Power Query. You would then check whether a year equal the Date.Year( Date.From( DateTime.LocalNow() ) ), and if so replace the year by the text: "Default". 


    This ofcourse turns the column to a text type. So it would be good to have a regular 'year' column and a 'year default' column. 

     

    You can see more on this here: https://gorilla.bi/power-bi/set-default-slicer-value/

     

    --------------------------------------------------

    @ me in replies or I'll lose your thread

     

    Master Power Query M? -> https://powerquery.how

    Read in-depth articles? -> BI Gorilla

    Youtube Channel: BI Gorilla

     

    If this post helps, then please consider accepting it as the solution to help other members find it more quickly.

    • ahmadov_10's avatar
      ahmadov_10
      Helper II

      Hello , i follow your solution but it doesn't satisfy my need : i want to see my slicer by default filtered when i open my report in the default value (auto filtering) 

      I tried isfiltered function but didn't work . (it seems like when your customer demand to show by defaut sales data in last year and after he have the choice to change slicer value) 

  • v-yuta-msft's avatar
    v-yuta-msft
    Community Support

    Hi ThunderRoad,

     

    Have you solved your issue by now? If you have, could you kindly mark my answer to close the thread?

     

    Regards,

    Jimmy Tao

  • Hello : i want to see my slicer by default filtered when i open my report in the default value (auto filtering) 

    I tried isfiltered function but didn't work . (it seems like when your customer demand to show by defaut sales data in last year and after he have the choice to change slicer value) 

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi, Is this solved ?? I have a similar requirement where i have to show a default year in filter and then give the end user power to filter all the other years too. Could you help ??