Forum Discussion
Date filter
gjadal - Can you add a little detail to this, are you trying to default the selection to the current week?
- gjadal10 years agoMicrosoft Employee
Basically I want a from date control and a To date control where the user can pick dates to filter the data.
By default I want the dates to be 1 week apart.
I tried using the time slicer but that doesnt have weeks as an option and its not very elegant..
- MattAllington10 years agoCommunity Champion
I don't know of any way to set a "default" period apart. You could set a start date and a "number of weeks" slicer and set that to 1. Then the user could change it from 1 week to anything else. Just an idea.
Or you could create 2 calendar tables, one for the FROM and one for the TO date.
each table should have a single column that contains the week date you want, eg week commencing dates or week ending - what ever you want.
don't join them to anything
write 2 harvester measures to "harvest" what has been selected.
From Date=max(FromCal[Date])
To Date = max(ToCal[Date])
write the a measure that reacts to the slicers. Something like this.
total sales selected period =
CALCULATE (sum(Sales[qty]),
filter (Sales,
Sales[date] >= [From Date] &&
Sales[Date] <= [To Date]
)
)