Forum Discussion

zausten's avatar
zausten
Helper I
4 years ago

Setting Default Date on Slicer

Hi,

Is there anyway to set a default date on a "between" date slicer.  Users do not want to use relative date

Old threads suggest not, has anyone been able to work around?

https://community.powerbi.com/t5/Desktop/How-to-set-Current-Date-in-Date-slicer/m-p/449893

 

Best I have come up with is get the TO date to be current date using below. 

MyDate =

if(

d_date[d_date] = TODAY(), TODAY(),

if(

'd_date'[d_date]<TODAY(), d_date[d_date]

)

)

 

thanks
Zeb

2 Replies

  • Hi zausten ,

    We can't let the slicer select Date = Today by default, but we can create a measure to show you the value on today.

    1.Creat a calendar date table, and put it into the slicer.

    Slicer = CALENDARAUTO()

     

    2.Create a measure, put it into the visual filter, and let the value is 1. The expiration date of the date column will be today by default. If you use the slicer, the visual will be filtered by the slicer.

     

    Measure =
    VAR _MINDATE =
        MIN ( Slicer[Date] )
    VAR _MAXDATE =
        MAX ( Slicer[Date] )
    RETURN
        IF (
            ISFILTERED ( Slicer[Date] ),
            IF (
                MAX ( 'Table'[Date] ) <= _MAXDATE
                    && MAX ( 'Table'[Date] ) >= _MINDATE,
                1,
                0
            ),
            IF ( MAX ( 'Table'[Date] ) <= TODAY (), 1, 0 )
    )

     

     

    I attach my sample below for reference.

    Best Regards,
    Community Support Team _ kalyj

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