Forum Discussion
limiting date slicer
Hi,
I have included a date slicer where I can specify the from and to dates.My problem statement as follows:
what ever date i select in the from part the to part will only show date within 90 days and not more than that.how do I implement the logic on power bi dashboard.
Thanks!
Hi Anonymous
If I understand correctly, you want to first select a from date, and then only the 90 days after the from date display in the slicer for users to select a to date within them. In short, the days between from date and to date should be limited to less than 90 days, right? If so, it seems difficult to realize this in a slicer. Instead, I find an alternative option which will use two date slicers. You may take a try if you have interest in it. Steps are as follows.
1. Create a Calendar table.
2. Create a Date From slicer with 'Calendar'[Date] as field. Change the slicer to After mode.
3. Create a Date To slicer with 'Calendar'[Date] as field. Change the slicer to Before mode.
4. Create two measures as below. Put Measure on the Date To visual's filter and set value is 1.
FromDate = MINX(ALLSELECTED('Calendar'[Date]),'Calendar'[Date])Measure = IF(MAX('Calendar'[Date])>=[FromDate] && MAX('Calendar'[Date])<[FromDate]+90,1,0)Now you will get the slicers like the following image:
You can download the PBIX file.
Best Regards,
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.
4 Replies
- v-jingzhang
Community Support
Hi Anonymous
If I understand correctly, you want to first select a from date, and then only the 90 days after the from date display in the slicer for users to select a to date within them. In short, the days between from date and to date should be limited to less than 90 days, right? If so, it seems difficult to realize this in a slicer. Instead, I find an alternative option which will use two date slicers. You may take a try if you have interest in it. Steps are as follows.
1. Create a Calendar table.
2. Create a Date From slicer with 'Calendar'[Date] as field. Change the slicer to After mode.
3. Create a Date To slicer with 'Calendar'[Date] as field. Change the slicer to Before mode.
4. Create two measures as below. Put Measure on the Date To visual's filter and set value is 1.
FromDate = MINX(ALLSELECTED('Calendar'[Date]),'Calendar'[Date])Measure = IF(MAX('Calendar'[Date])>=[FromDate] && MAX('Calendar'[Date])<[FromDate]+90,1,0)Now you will get the slicers like the following image:
You can download the PBIX file.
Best Regards,
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.
- visheshjain
Impactful Individual
Hello v-jingzhang,
So sorry!
I had a similar post and thought the response was in reference to my post.
I did not see the original post.
Apologies!
- lbendlin
Super User
If that is your goal, what is the point of having a "to" part in your slicer? Use a slicer with a single date value instead.
- visheshjain
Impactful Individual
Hi lbendlin,
So sorry!
I had a similar post and thought the response was in reference to my post.
I did not see the original post.
Apologies!