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

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.

Reply
sjpathak
Frequent Visitor

Date Slicer to show last 7 days (excluding today)

Hi,

 

Am aware that slicers cannot have 'visual filters' on them. I have a Dite dimension listing dates for several years, but i want to display a report based on a slicer for last 7 days only (excluding today). I have hacked it to work to show 7 days only by adding two slicers, selecting last week in the first and then hiding it.

 

Date SlicerDate Slicer

 

However, if TODAY() = 27th Sept 2018, I don't want that to be shown in the slicer, but dates for the week before today.

 

Questions

1. Is it possible to have a date slicer working on a date dimension to display only last 7 days (excluding today)?

2. Is it possible to apply a visual level filter on Date Dimension when its used as a slicer?

 

Thanks

1 ACCEPTED SOLUTION

5 REPLIES 5
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @sjpathak,


 

 Questions

1. Is it possible to have a date slicer working on a date dimension to display only last 7 days (excluding today)?

2. Is it possible to apply a visual level filter on Date Dimension when its used as a slicer?

 


 

We may not create a date slicer working on a date dimension to display only last 7 days (excluding today).

 

Why not use Relative date filter in visual level filter?

 

visual level relative date.PNG

 

 

2. Date slicer doesn't have visual level filter in Power BI.

 

You could vote this similar idea in Power BI ideas forum.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Well, this eventually worked for me: https://prologika.com/overwriting-power-bi-filters/!!

PattemManohar
Community Champion
Community Champion

Try adding another field to flag Last7Days as below

 

IF([Date]>=NOW()-7 && [Date]<=NOW()-1,"Y","N")

 

Add the flag to report level filters to "Y"

 

image.png

Hope this resolves your issue !!





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




I was doing that only initially, but the issue of adding report/page level filters is that then all my visuals get filtered on that, however, I want one of my visual to not to filter on dates, but show all available dates.

 

That's why I had to remove the report/page level filter and started adding that IsLastWeek kind of filter to individual visuals. But removing the report level filter altered my Date slicer and that's why i hacked it by adding a duplicate hidden slicer. However, I need the last day not shown in that, and that the current problem.

 

Maybe am following the wrong chain of thoughts to solve a totally different problem of ignoring report level filters for a single visual, but this is the best I could work it out. Any inputs on how to achieve to remove the report level filter to a single visual or to apply visual filter to a slicer would help immensely.

Ok, try creating a calculated table which will contain only the dates which are flagged as "Y" (as mentioned in above post) in the Date table. Use the date field in this new calculated table as the Slicer. Then, you are not using any report or visual level filters... Make sure you have datekey as well to have relationship with the main Date table, otherwise your data will not get filtered out as per the selection in the slicer. Hope this should work !! 





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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