Forum Discussion
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
Anonymous
I recently made a video to solve the common default date filter problems, please refer to this video:
https://youtu.be/KBEsPGxDxHM
4 Replies
- amitchandakSuper User
Anonymous , As of now we can not initialize both days.
The workaround is you can clear a new column in the date table
Switch( true() ,
[date] >= today() && [date] >= today() -7 , "Last 7 days",
"others"
)
Or you can use a relative date slicer
Or approach like this https://community.powerbi.com/t5/Desktop/Required-custom-date-Slicer-Last-7-days-last-15-days-last-30/m-p/1284966#M561629
- AnonymousNot 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.
- FowmySuper User
Anonymous
I recently made a video to solve the common default date filter problems, please refer to this video:
https://youtu.be/KBEsPGxDxHM
- AnonymousNot 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.