Forum Discussion

DataSpace's avatar
DataSpace
Icon for Helper II rankHelper II
2 years ago
Solved

Set default 7 days dates to Date (between) slicer

I have a client requirement where Date (Between) Slicer need to set default for last one week as shown below: From Date: date before 7 days from today. To Date: today's date                      ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi DataSpace 

     

    Maybe you can try this:

    First of all, I create a set of sample:

     

    Then add a calculate column:

    Column =
    VAR _CurrentDate =
        TODAY ()
    RETURN
        IF (
            'Table'[Date]
                >= DATE ( YEAR ( _CurrentDate ), MONTH ( _CurrentDate ), DAY ( _CurrentDate ) - 7 )
                && 'Table'[Date] <= _CurrentDate,
            "LastOneWeek",
            FORMAT ( 'Table'[Date], "yyyy-mm-dd" )
        )

     This column mark the last 7 days as the LastOneWeek:

    The result is as follow:

     

    Best Regards

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