Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Date Slicer: Default values

Dear community,

 

I know there are several threads regarding the question of adding default values to a slicer but so far I did not find a solution to my problem.

 

I am having a report with several visuals which interact with the standard Power BI date slicer:

 

 

I am trying to setup a default value for the "time frame selection" which always shows the previous 7 days when I open the report.

Example for today (30.07.2021): From 23.07.2021 until 29.07.2021

 

My problem is that I am looking for a solution which enables our users to also make an individual adjustement of the time frame by using the slicer. Maybe someone can help me out on that point.

 

Best regards and thanks in advance!

 

Carsten

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Currently, there is no such function to set a default value for the slicer. But you can achieve this goal through the following methods.

    1.Create a seperate table by entering data. 

    Here I use the exclamation mark to make him the first place in the slicer. The slicer is set to single selection.

     

    2. Then the measure can be created like

    Measure = IF(SELECTEDVALUE('Table (3)'[default value])="!previous 7 days",CALCULATE(SUM('Main table'[Value]),FILTER('Calendar',[Date]<=TODAY()&&[Date]>=TODAY()-6)),SUM('Main table'[Value]))

     

    In this way, every time you open the report, the default is the data of the previous seven days. If you want to filter, select all from the single-choice slicer and filter the date range.

     

     

    Best Regards,

    Stephen Tao

     

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

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Just a quick update from my side since I tried all the solutions mentioned above. Unfortunately, they did not lead me to the success which is required by our company.

     

    Therefor I created an own approach:

     

    - Setup of three individual buttons which are linked to several pages including different pre-specified relative periods:

     

     

    - Setup of anothrer individual button that triggers one sub-page including a slicer:

     

     

    I know it is not the most clean solution but it actually works quite well.