cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper II
Helper II

Set default date to today on date slicer

Hi everyone, I am using the between date slicer and I would like to know if there is a possibility to set the first and second date to today by default every time we open the report. (Below my date table)

 date slicer.PNGdate table.PNG

1 ACCEPTED SOLUTION
Community Support
Community Support

Hi @idir_HO 

In addtion to Fowmy and  

 

Slicer = CALENDAR(DATE(2020,10,01),DATE(2020,10,10))

 

Then Build a Date Measure and build a Table visual by this Date Measure and other columns.

 

M.Date =
VAR _MAX =
    MAX ( Slicer[Date] )
VAR _MIN =
    MIN ( Slicer[Date] )
VAR _Select =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( 'Table', 'Table'[Date] <= _MAX && 'Table'[Date] >= _MIN )
    )
VAR _Default =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( 'Table', 'Table'[Date] = TODAY () )
    )
RETURN
    IF ( ISFILTERED ( Slicer[Date] ), _Select, _Default )

 

The Table visual will show you Today's value if you don't select slicer.

You can download the pbix file from this link: Set default date to today on date slicer

 

Best Regards,

Rico Zhou

 

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

 

View solution in original post

4 REPLIES 4
Community Support
Community Support

Hi @idir_HO 

In addtion to Fowmy and  

 

Slicer = CALENDAR(DATE(2020,10,01),DATE(2020,10,10))

 

Then Build a Date Measure and build a Table visual by this Date Measure and other columns.

 

M.Date =
VAR _MAX =
    MAX ( Slicer[Date] )
VAR _MIN =
    MIN ( Slicer[Date] )
VAR _Select =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( 'Table', 'Table'[Date] <= _MAX && 'Table'[Date] >= _MIN )
    )
VAR _Default =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( 'Table', 'Table'[Date] = TODAY () )
    )
RETURN
    IF ( ISFILTERED ( Slicer[Date] ), _Select, _Default )

 

The Table visual will show you Today's value if you don't select slicer.

You can download the pbix file from this link: Set default date to today on date slicer

 

Best Regards,

Rico Zhou

 

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

 

View solution in original post

This might work a look too if using the date picker is an option
https://www.youtube.com/watch?v=VaJ10ilXp6Y

 

P_D_G_0-1602138213510.png

Best,

PDG

Super User IV
Super User IV

@idir_HO , There no direct way. You can create some flag and restrict the values, That is successful in case of single date of flag as slicer itself

 

Example

Date Type = SWITCH(TRUE(),'Date'[Date] >= =TODAY() -20 && 'Date'[Date] <=TODAY(),"Last Dates"
,'Date'[Date]&"")

 

Date Type = SWITCH(TRUE(),'Date'[Date]=max(Table[Date]),"Lastest Date"
,'Date'[Date]&"")

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Community Champion
Community Champion

@idir_HO 


I do not think that is possible, however, you can search in the Ideas and vote for the same feature or create a new idea at https://ideas.powerbi.com/ideas/

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors