Forum Discussion

murali5431's avatar
murali5431
Helper III
2 years ago
Solved

Custom setting for date slicer

Hi,

 

I am building a dashboard which contains data from last 30 days to next 30 days based on "Arrival Date" field.

 

I am looking to create a date slicer with slider which defaults between oldest date (-30 days) to current date, while dashboard is launched. The user can then choose to change the dates based on his/her need.

 

Could you please assist?

 

Thanks in advance!

Muralidhar 

4 Replies

  • murali5431 , You can create a dynamic date table which show +30 and -30 days by going to modelling tab and create a new table

     


    DateRange =
    VAR StartDate = TODAY() - 30
    VAR EndDate = TODAY() + 30
    RETURN
    CALENDAR(StartDate, EndDate)

     

    After that you can create one new measure from this table for default date range 

     


    DefaultDateRange =
    VAR MinDate = TODAY() - 30
    VAR MaxDate = TODAY()
    RETURN
    IF(
    SELECTEDVALUE('DateRange'[Date]) >= MinDate && SELECTEDVALUE('DateRange'[Date]) <= MaxDate,
    1,
    0
    )

     

    And add this measure in visual of the slicer and set the filter to show items where Default date range=1 and create a slider and between slicer

    • murali5431's avatar
      murali5431
      Helper III

      bhanu_gautam Thanks a lot for your quick response!

       

      What I obtained currently is below, where current date at the end of the slider

       

      My objective is to obtain a slicer as below on launch, after which the user can drag the slider till end (+30 days), as needed.

       

      Hope this explains my requirement.

       

      Thanks,

      Muralidhar