Forum Discussion
Dynamically Enable and Disable Date Dropdown
I’m trying to disable a date hierarchy dropdown slicer based on the selection of another dropdown slicer.
I’ve already received great help from danextian , whom I’m tagging again in case they can help me this time as well to disable a between date filter.
The behavior I want is as follows:
Option 1
When I select “Custom” on the period slicer, the date slicer should work correctly and be enabled (this already works properly).
Option 2
When I select a value other than “Custom” on the period slicer, the date slicer should be disabled (this part works), but it should not display previously selected values or the “All" option. I expect it to be EMPTY.
Right now, if I already have values selected on the date slicer and I select a value other than “Custom” on the period slicer, the date slicer shows the previously selected values; and if there were no prior selections, it shows "All".
Is it possible to correct this behavior so as not to confuse the user?
If possible, I’d like a solution that doesn’t use bookmarks.
Thanks for your patience and help.
here the link to the pbix file:
https://www.transfernow.net/dl/20260218IsL4rIXM
9 Replies
- RicardoTraNaResponsive Resident
Hi there! in Power BI, there’s no built-in way to truly “disable” a slicer or automatically clear its selection based on another slicer. That’s why you see the previous values or “All” showing up.
The closest way to get the behavior you want is to make the date slicer effectively ignored when the period selected isn’t “Custom.” Here’s how:
- Detect the “Custom” selection with a measureIsCustom = IF(SELECTEDVALUE(Period[Type]) = "Custom", TRUE(), FALSE()- Adjust your calculations so the date slicer only affects results when IsCustom is TRUE:
FilteredMeasure = CALCULATE( [YourMeasure], IF( [IsCustom], ALLSELECTED(Date), -- slicer applies ALL(Date) -- slicer ignored ) )
- (Optional) Show a message on a card to let users know the date filter isn’t active:DateMessage = IF([IsCustom], "", "Date filter does not apply for this period"This way:
If “Custom” is selected → date slicer works normally.
If another period is selected → slicer is ignored, and the user sees consistent results.
Hope that help!!!
- lucadelicioImpactful IndividualProbably I didn’t explain myself well.
What I want is not for the measures to be calculated over a specific period they already do that, and the slicers are meant precisely to allow choosing a specific or custom period.
What I want is that, when I select a specific period, the date slicer does not show years that have nothing to do with the selection, because they only confuse the user.
These are the real limitations of Power BI’s user experience that I don’t understand.
I’m waiting for some official answers from Microsoft.
Thanks anyway for your help.- v-hashadapuCommunity Support
Hi , Thank you for reaching out to the Microsoft Community Forum.
Can you provide more details, because the behaviour depends entirely on how your tables are structured. Specifically, could you confirm whether the Period table is connected to the Date table and share the relationship type and cross-filter direction and whether the Period slicer is based on a disconnected table? A simple model diagram or a stripped-down PBIX with very small sample data would be ideal. The reason this matters is that slicers only react to actual filter propagation in the data model, so whether Period physically filters Date or only drives measures changes the solution completely.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
- lucadelicioImpactful Individual
Hi v-hashadapu
i publish the link to download the pbix file.
Are you able to download it?
Let me know.
- v-hashadapuCommunity Support
Hi lucadelicio , hope you are doing great. May we know if your issue is solved or if you are still experiencing difficulties. Please share the details as it will help the community, especially others with similar issues.
- lucadelicioImpactful Individual
I don't resolve the ux problem and (as i thought) i need to take a different way with more technical difficulties and a different UX. I understand very well the limit of PowerBI in this specific case using filter.
I will try to open a PoewrBI ideas.
Thank you for the support.
- danextianSuper User
Hi lucadelicio
Use a physical datetime column instead of the one generated by the Auto Datetime hierarchy. As a best practice, disable Auto Datetime and explicitly create the datetime attributes yourself. Auto Datetime creates a hidden table for almost every datetime column in the model, which unnecessarily bloats the model.
Date = ADDCOLUMNS( CALENDAR(DATE(2018,1,1), DATE(2021,12,31)), "Year", YEAR([Date]), "Month Number", MONTH([Date]), "Month", FORMAT([Date], "MMMM"), "Month Short", FORMAT([Date], "MMM"), "YearMonth", FORMAT([Date], "YYYY-MM"), "Quarter", "Q" & FORMAT([Date], "Q"), "YearQuarter", FORMAT([Date], "YYYY") & " Q" & FORMAT([Date], "Q"), "Day", DAY([Date]), "Weekday Number", WEEKDAY([Date], 2), -- Monday = 1 "Weekday", FORMAT([Date], "dddd"), "Weekday Short", FORMAT([Date], "ddd") )- lucadelicioImpactful Individual
Thank you danextian for the answer.
I'm not using the automatic date/time period (is disable) i create a specific hierarchy as the best practice mode.
Infact is working but the problem remains the previous selected value when i change from Custom to Selected period. Also the "All" value is not so clear for the final user.
See the image post.
Probably the only way for now is to create a Bookmark and add an ADDITIONAL button and so add an additional click to the final user. Way that i would like to avoid.
Thank you anyway