Forum Discussion
Set default 7 days dates to Date (between) slicer
- Anonymous2 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.
Thanks Anonymous for your response.
This can work with Date (Dropdown) slicer, but how to map thi column with Date (Between) Slicer.
Because when it map Date column with Date(Between ) slicer, it takes by default takes min and max value from that column. so it will skill the hard code value 'Last one week'.
Can you please explain a bit more to make me understand ?
Regards,
Hi DataSpace
The workaround doesn't applicable to the between Slicer, because the format of the calculate column is text.
This workaround is to get the date of today by using TODAY() function, then mark the last 7 days of today as the LastOneWeek.
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.