Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
iW1DOV
Frequent Visitor

How to select Today's date in slicer via a button?

HI all, 

My customer wants to select todays' date in a slicer by clicking on a button - more precisely, the date slicer is a multiselect one; he wants a "Today" button that resets all previous selections and selects the current date. 

The slicer is hierarchical, with year, month name and day; calendar keep last three years; Todays' date is displayed as the string "Today".

I tried via a bookmark, but it does not work, because the bookmark saves the current slicer state; if I save the bookmark with "Today" selected - for example - in Week 49, then when the user clicks it in - say - week 50 , it reverts the slicer to week 49 and "Today" selected in that week. Moreover, since  "Today" in W49 isn't the current date anymore, when user change the slicer selection, it disappears from W49 (and moves to the appropriate week, of course). The same goes for the month and year.

Anyone has suggestion on how to accomplish the required task? 

Thanks in advance.
Gianfranco 

7 REPLIES 7
v-xinc-msft
Community Support
Community Support

Hi @iW1DOV ,

I used the same method to create the slicer and the button, and when the date is updated, I click the 'Today' button, it resets all previous selections and shows the latest date. I didn't meet the problem you mentioned.

2.png

1.png

Could you please provide example data or sample files here if you have any confused? We could offer you more help if we have information in detail. There is sensitive data that can be removed in advance. How to provide sample data in the Power BI Forum - Microsoft Fabric Community

Thanks for your understanding. Your time and cooperation are much valued by us. We are looking forward to hearing from you to assist further.

Best regards,

Lucy Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Lucy, sorry for the delay; I was on new year leave. BTW: I wish you an happy new year. 

I can't get the solution working: 

iW1DOV_1-1736259400940.png

 

As you can see, the bookmark filters the date slicer as expected, but it does not select "Today" as the selected date (BTW: previously my bookmark *Selected* today, instead of *filtering* it). The result is, 
the date filter is applied incorrectly (notice the card in the report title bar) . 

I will post a sample report as soon as I will manage to sanitize sensitive data. 

Thank you again and best regards, 

Gianfranco 

Hi @iW1DOV ,

Thank you for your kindly feedback! Wish you will have an even better year!
Do you refresh the data after changing the system time? If the issue still can't be solved, I think we really needs to get your example file and look forward to you posting your example file to help us provide more help! 

Thanks for your understanding. Your time and cooperation are much valued by us. We are looking forward to hearing from you to assist further.

Best regards,

Lucy Chen

Hi Lucy, 

Here it is my sample file: https://we.tl/t-TUVCH2PimL It has some flaws because I had to quickly  refactor it from the real report, which connects to a separate semantic model, but it reproduces the behavior I am experiencing. 

Thank you for your time, help and patience! 

Regards, 

Gianfranco 

Hi @iW1DOV ,

Thank you for the sample file!

When I click on the 'today' button, it can return the current date successfully.

1.png

2.png

In the calculated column you created, we could similarly observe that the result returned for ‘Today’ is January 10, 2025.

3.png

When I change the date, the date of today changes as well.

4.png

I think maybe you didn't filter the slicer to show ‘today’ before you created the bookmark.

Create report bookmarks in Power BI - Power BI | Microsoft Learn

Follow the steps below to try to recreate the bookmark.

1. Filter Slicer: Filter the Analysis Date slicer in the report to show only the rows for “Today”.

5.png

2. Then we click the 'Add' button to create a new bookmark and name this bookmark “Selected Today”. We should make sure that in the 'view', this bookmarked page is showing today's date.

6.png

3. Add a button to the report and select the “Select Today” bookmark you just created. This way, when the user clicks the button, the slicer will automatically filter and display the current date.

7.png

Because your file is too large, beyond the limit of files we can upload, I offer a lite versione, hope it will help you.

After clicking refresh data in your file, it may take time to refresh the date, please be patient and wait for about 30 to 40 seconds to view the refreshed data.

If you still have any questions, please feel free to share with us here!if you have any questions, please feel free to share with us here!

Best regards,

Lucy Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

iW1DOV
Frequent Visitor

Uhm.... this closely resembles what I did, and it does not work. 

It seems the bookmark (or the slicer) saves the actual date behaind "Today", so when the user clicks the button to select the current date days after the bookmark was created, it actually selects the wrong date.

DataNinja777
Super User
Super User

Hi @iW1DOV ,

 

To create a "Today" button that dynamically resets a hierarchical date slicer to select today's date, you can use a calculated column and a bookmark.

First, add a calculated column to your calendar table:

TodayFlag = IF('Calendar'[Date] = TODAY(), "Today", BLANK())

Then, set up your hierarchical slicer (Year > Month > Day) and include the TodayFlag column. Create a bookmark by filtering the slicer to show rows where TodayFlag = "Today", and save this bookmark as "Today."

For the button, assign the action to the "Today" bookmark. The dynamic behavior of the TodayFlag column ensures the bookmark always selects the current date, adapting daily without manual updates.

 

Best regards,

 

 

Helpful resources

Announcements
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.

"); $(".slidesjs-pagination" ).prependTo(".pagination_sec"); $(".slidesjs-pagination" ).append("
"); $(".slidesjs-play.slidesjs-navigation").appendTo(".playpause_sec"); $(".slidesjs-stop.slidesjs-navigation").appendTo(".playpause_sec"); $(".slidesjs-pagination" ).append(""); $(".slidesjs-pagination" ).append(""); } catch(e){ } /* End: This code is added by iTalent as part of iTrack COMPL-455 */ $(".slidesjs-previous.slidesjs-navigation").attr('tabindex', '0'); $(".slidesjs-next.slidesjs-navigation").attr('tabindex', '0'); /* start: This code is added by iTalent as part of iTrack 1859082 */ $('.slidesjs-play.slidesjs-navigation').attr('id','playtitle'); $('.slidesjs-stop.slidesjs-navigation').attr('id','stoptitle'); $('.slidesjs-play.slidesjs-navigation').attr('role','tab'); $('.slidesjs-stop.slidesjs-navigation').attr('role','tab'); $('.slidesjs-play.slidesjs-navigation').attr('aria-describedby','tip1'); $('.slidesjs-stop.slidesjs-navigation').attr('aria-describedby','tip2'); /* End: This code is added by iTalent as part of iTrack 1859082 */ }); $(document).ready(function() { if($("#slides .item").length < 2 ) { /* Fixing Single Slide click issue (commented following code)*/ // $(".item").css("left","0px"); $(".item.slidesjs-slide").attr('style', 'left:0px !important'); $(".slidesjs-stop.slidesjs-navigation").trigger('click'); $(".slidesjs-previous").css("display", "none"); $(".slidesjs-next").css("display", "none"); } var items_length = $(".item.slidesjs-slide").length; $(".slidesjs-pagination-item > button").attr("aria-setsize",items_length); $(".slidesjs-next, .slidesjs-pagination-item button").attr("tabindex","-1"); $(".slidesjs-pagination-item button").attr("role", "tab"); $(".slidesjs-previous").attr("tabindex","-1"); $(".slidesjs-next").attr("aria-hidden","true"); $(".slidesjs-previous").attr("aria-hidden","true"); $(".slidesjs-next").attr("aria-label","Next"); $(".slidesjs-previous").attr("aria-label","Previous"); //$(".slidesjs-stop.slidesjs-navigation").attr("role","button"); //$(".slidesjs-play.slidesjs-navigation").attr("role","button"); $(".slidesjs-pagination").attr("role","tablist").attr("aria-busy","true"); $("li.slidesjs-pagination-item").attr("role","list"); $(".item.slidesjs-slide").attr("tabindex","-1"); $(".item.slidesjs-slide").attr("aria-label","item"); /*$(".slidesjs-stop.slidesjs-navigation").on('click', function() { var itemNumber = parseInt($('.slidesjs-pagination-item > a.active').attr('data-slidesjs-item')); $($('.item.slidesjs-slide')[itemNumber]).find('.c-call-to-action').attr('tabindex', '0'); });*/ $(".slidesjs-stop.slidesjs-navigation, .slidesjs-pagination-item > button").on('click keydown', function() { $.each($('.item.slidesjs-slide'),function(i,el){ $(el).find('.c-call-to-action').attr('tabindex', '-1'); }); var itemNumber = parseInt($('.slidesjs-pagination-item > button.active').attr('data-slidesjs-item')); $($('.item.slidesjs-slide')[itemNumber]).find('.c-call-to-action').attr('tabindex', '0'); }); $(".slidesjs-play.slidesjs-navigation").on('click', function() { $.each($('.item.slidesjs-slide'),function(i,el){ $(el).find('.c-call-to-action').attr('tabindex', '-1'); }); }); $(".slidesjs-pagination-item button").keyup(function(e){ var keyCode = e.keyCode || e.which; if (keyCode == 9) { e.preventDefault(); $(".slidesjs-stop.slidesjs-navigation").trigger('click').blur(); $("button.active").focus(); } }); $(".slidesjs-play").on("click",function (event) { if (event.handleObj.type === "click") { $(".slidesjs-stop").focus(); } else if(event.handleObj.type === "keydown"){ if (event.which === 13 && $(event.target).hasClass("slidesjs-play")) { $(".slidesjs-stop").focus(); } } }); $(".slidesjs-stop").on("click",function (event) { if (event.handleObj.type === "click") { $(".slidesjs-play").focus(); } else if(event.handleObj.type === "keydown"){ if (event.which === 13 && $(event.target).hasClass("slidesjs-stop")) { $(".slidesjs-play").focus(); } } }); $(".slidesjs-pagination-item").keydown(function(e){ switch (e.which){ case 37: //left arrow key $(".slidesjs-previous.slidesjs-navigation").trigger('click'); e.preventDefault(); break; case 39: //right arrow key $(".slidesjs-next.slidesjs-navigation").trigger('click'); e.preventDefault(); break; default: return; } $(".slidesjs-pagination-item button.active").focus(); }); }); // Start This code is added by iTalent as part of iTrack 1859082 $(document).ready(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); $("#tip2").attr("aria-hidden","true").addClass("hidden"); $(".slidesjs-stop.slidesjs-navigation, .slidesjs-play.slidesjs-navigation").attr('title', ''); $("a#playtitle").focus(function(){ $("#tip1").attr("aria-hidden","false").removeClass("hidden"); }); $("a#playtitle").mouseover(function(){ $("#tip1").attr("aria-hidden","false").removeClass("hidden"); }); $("a#playtitle").blur(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); }); $("a#playtitle").mouseleave(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); }); $("a#play").keydown(function(ev){ if (ev.which ==27) { $("#tip1").attr("aria-hidden","true").addClass("hidden"); ev.preventDefault(); return false; } }); $("a#stoptitle").focus(function(){ $("#tip2").attr("aria-hidden","false").removeClass("hidden"); }); $("a#stoptitle").mouseover(function(){ $("#tip2").attr("aria-hidden","false").removeClass("hidden"); }); $("a#stoptitle").blur(function(){ $("#tip2").attr("aria-hidden","true").addClass("hidden"); }); $("a#stoptitle").mouseleave(function(){ $("#tip2").attr("aria-hidden","true").addClass("hidden"); }); $("a#stoptitle").keydown(function(ev){ if (ev.which ==27) { $("#tip2").attr("aria-hidden","true").addClass("hidden"); ev.preventDefault(); return false; } }); }); // End This code is added by iTalent as part of iTrack 1859082
Top Solution Authors