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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Create a last 7 days date filter button which updates date slicer

Hi, I'd like to implement a last 7 days date filter that would be represented as a button. At the same time, the user should have the option to select a custom date range with the slicer. For example if today is March 7th and the custom date slicer is set to show data from February 12 - February 17 but then the "Last 7 Days" button is pressed, dates from March 1 - March 7 should still be shown. In a way, the button should override the date filter selected in the slicers.

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 

How about using a Bookmark?

 

1. Create a report page with default name of "Page 1".

page1.PNG

 

2. Insert a blank button with button text of "Last 7 days Filter" on "Page 1".

blank botton.jpg

button text.PNG

page1-button.PNG

 

3. Duplicate "Page 1" and rename it as "Bookmark of Last 7 days".

 

4. In Bookmark pane, add "Bookmark of Last 7 days" page as a bookmark and rename it as "Bookmark of Last 7 days".

BOOKMARK.PNG

 

5. Set action of "Last 7 days Filter" button on "Page 1".

action.PNG

 

6. Create a Measure.

Last 7 days filter Measure = 
VAR DateDiff_ =
    DATEDIFF ( MAX ( 'Table'[Date] ), TODAY (), DAY )
RETURN
    IF ( DateDiff_ <= 7, 1 )

 

7. Put "Last 7 days filter measure" on "Filters on this visual" of each visualyou want to filter on "Bookmark of Last 7 days" page, and apply filter of "is 1".

filter.PNG

 

8. Update bookmark.

update bookmark.jpg 

 

9. Inset a Back button on "Bookmark of Last 7 days" page.

button back.jpg

 

10. Test.

bookmark.gif

 

For more details, please check the attached PBIX file.

 

 

Best Regards,

Icey

 

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

I think you use some custom slicer. The relative will not allow date and the range base will not automatically select and another date.

https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak exactly, only using a relative slicer does not integrate well with an already existing date slicer as you have to make sure the date slicer covers the relative slicers date range. Not a great solution.

Icey
Community Support
Community Support

Hi @Anonymous ,

 

How about using a Bookmark?

 

1. Create a report page with default name of "Page 1".

page1.PNG

 

2. Insert a blank button with button text of "Last 7 days Filter" on "Page 1".

blank botton.jpg

button text.PNG

page1-button.PNG

 

3. Duplicate "Page 1" and rename it as "Bookmark of Last 7 days".

 

4. In Bookmark pane, add "Bookmark of Last 7 days" page as a bookmark and rename it as "Bookmark of Last 7 days".

BOOKMARK.PNG

 

5. Set action of "Last 7 days Filter" button on "Page 1".

action.PNG

 

6. Create a Measure.

Last 7 days filter Measure = 
VAR DateDiff_ =
    DATEDIFF ( MAX ( 'Table'[Date] ), TODAY (), DAY )
RETURN
    IF ( DateDiff_ <= 7, 1 )

 

7. Put "Last 7 days filter measure" on "Filters on this visual" of each visualyou want to filter on "Bookmark of Last 7 days" page, and apply filter of "is 1".

filter.PNG

 

8. Update bookmark.

update bookmark.jpg 

 

9. Inset a Back button on "Bookmark of Last 7 days" page.

button back.jpg

 

10. Test.

bookmark.gif

 

For more details, please check the attached PBIX file.

 

 

Best Regards,

Icey

 

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors