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.
try adding below dax in your slicer;
LastSevenDays =
VAR CurrentDate = TODAY()
VAR MinDate = CurrentDate - 6
VAR MaxDate = CurrentDate
RETURN CALCULATE( [Your_table], FILTER( ALL('YourDateColumn'), 'YourDateColumn' >= MinDate && 'YourDateColumn' <= MaxDate ) )
let me know if you encounter any error...
If this helped, Follow this blog for more insightful information about data analytics
https://analyticpulse.blogspot.com/
https://analyticpulse.blogspot.com/2024/04/commercial-real-estate-portfolio.html
- DataSpace2 years ago
Helper II
1. There should be some expression insted of scaler table as first argument in CALCULATE function.
what it should be?
2. How to assign this measure to slicer? How it will set required values to 'From Date' and 'To Date' in Date range(between) slicer?
Please guide