Forum Discussion

lauriedata's avatar
lauriedata
Resolver I
9 months ago
Solved

2 default dates in slicer

 

 

Is there a way to have the most recent two dates be a default choice in a slicer, not just one?  I can't have them combined into a "last 2 days" choice UNLESS I CAN ALSO have the last two dates as independent choices.  That is, the user needs to be able to either choose "last 2 days" or switch the default to one of the last two days and any other day they prefer in the calendar.  Thanks in advance.

  • lauriedata you should have a new column for default selection and use that as a slicer:

     

    New Column for Slicer = 
    VAR __Today = TODAY ()
    VAR __Date = 'Calendar'[Date]
    RETURN
    SWITCH ( 
        TRUE (),
        __Date = __Today, "Current Date",
        __Date = __Today - 1, "Prev Date",
        __Date
    )

     

     

    Select "Current Date" and "Prev Date" in the slicer; these will be the default selection for every day, and users can pick one if required.

     

  • Hi lauriedata 

    Just checking in to see if the previous response helped resolve your issue. If not, feel free to share your questions and we’ll be glad to assist.

3 Replies

  • lauriedata you should have a new column for default selection and use that as a slicer:

     

    New Column for Slicer = 
    VAR __Today = TODAY ()
    VAR __Date = 'Calendar'[Date]
    RETURN
    SWITCH ( 
        TRUE (),
        __Date = __Today, "Current Date",
        __Date = __Today - 1, "Prev Date",
        __Date
    )

     

     

    Select "Current Date" and "Prev Date" in the slicer; these will be the default selection for every day, and users can pick one if required.

     

    • v-aatheeque's avatar
      v-aatheeque
      Community Support

      Hi lauriedata 

      Just checking in to see if the previous response helped resolve your issue. If not, feel free to share your questions and we’ll be glad to assist.