The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
I’m building an intra-day Power BI report and I have a requirement to control the behavior of date filters based on a user selection.
I’ve created a disconnected table DatePeriods with 3 options:
Today
Yesterday
Single Date
Expected behavior:
When the user selects "Today" or "Yesterday", the report should show data for today or yesterday automatically.
When the user selects "Single Date", only then the date slicer (from the main Date table) should become active and allow them to select a custom date.
If any other option is selected, the date slicer should appear disabled or hidden.
I’ve written a measure like below to calculate the selected date:
DatePeriods =UNION(// TodayADDCOLUMNS(FILTER(CALENDAR(MIN('Date'[Date]), MAX('Date'[Date])), [Date] = TODAY()),"Type", "Today","Sort", 1),// YesterdayADDCOLUMNS(FILTER(CALENDAR(MIN('Date'[Date]), MAX('Date'[Date])), [Date] = TODAY() - 1),"Type", "Yesterday","Sort", 2),// Custom Range (Allow users to select this and manually adjust dates)ADDCOLUMNS(CALENDAR(MIN('Date'[Date]), MAX('Date'[Date])),"Type", "Custom","Sort", 3))I want to show or enable the date slicer only when "Single Date" is selected. Is there a recommended way to implement this in Power BI?
Thanks in advance!
Solved! Go to Solution.
Hi @manoj_0911 ,
Slicer works on column. to make this, create a calculated column in the table having dates, and classify it as today, yesterday and single date. now use that column for first slicer and date column as second.
Hi @manoj_0911,
Thanks for posting your question in the Microsoft Fabric Forum Community. And also thanks to @Rupak_bi for prompt and helpful response.
To control how the date slicer works based on what the user picks:
create a separate table with three choices: Today, Yesterday, and Single Date. Add a slicer using this table so users can choose one of those options.
Based on what they pick, show data for today, yesterday, or let them pick a specific date. Instead of using the date slicer directly, use a calculation to decide what date to show.
To make the date slicer usable only when "Single Date" is picked:
You can put a shape or message over it to block it when not needed, or Use a setting to hide the slicer completely unless "Single Date" is selected.
Thanks & regards,
Prasanna Kumar
Hi @manoj_0911,
Just a gentle reminder has your issue been resolved? If so, we’d be grateful if you could mark the solution that worked as Accepted Solution, or feel free to share your own if you found a different fix.
This not only closes the loop on your query but also helps others in the community solve similar issues faster.
Thank you for your time and feedback!
Best,
Prasanna Kumar
Hi @manoj_0911,
We wanted to kindly check in to see if everything is working as expected after trying the suggested changes to craete a new table for seletions. If there’s anything else we can assist with, please don’t hesitate to ask.
Warm regards,
Prasanna Kumar
Hi @manoj_0911,
Just following up to see if the solution provided was helpful in resolving your issue. Please feel free to let us know if you need any further assistance.
Best regards,
Prasanna Kumar
Hi @manoj_0911,
Thanks for posting your question in the Microsoft Fabric Forum Community. And also thanks to @Rupak_bi for prompt and helpful response.
To control how the date slicer works based on what the user picks:
create a separate table with three choices: Today, Yesterday, and Single Date. Add a slicer using this table so users can choose one of those options.
Based on what they pick, show data for today, yesterday, or let them pick a specific date. Instead of using the date slicer directly, use a calculation to decide what date to show.
To make the date slicer usable only when "Single Date" is picked:
You can put a shape or message over it to block it when not needed, or Use a setting to hide the slicer completely unless "Single Date" is selected.
Thanks & regards,
Prasanna Kumar
Hi @manoj_0911 ,
Slicer works on column. to make this, create a calculated column in the table having dates, and classify it as today, yesterday and single date. now use that column for first slicer and date column as second.