Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Solved! Go to Solution.
Hi @Anonymous ,
How about using a Bookmark?
1. Create a report page with default name of "Page 1".
2. Insert a blank button with button text of "Last 7 days Filter" on "Page 1".
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".
5. Set action of "Last 7 days Filter" button on "Page 1".
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".
8. Update bookmark.
9. Inset a Back button on "Bookmark of Last 7 days" page.
10. Test.
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.
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
@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.
Hi @Anonymous ,
How about using a Bookmark?
1. Create a report page with default name of "Page 1".
2. Insert a blank button with button text of "Last 7 days Filter" on "Page 1".
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".
5. Set action of "Last 7 days Filter" button on "Page 1".
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".
8. Update bookmark.
9. Inset a Back button on "Bookmark of Last 7 days" page.
10. Test.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
83 | |
67 | |
61 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |