Forum Discussion
Dynamic Date Slicer
Hi,
I need a date slicer to dynamically show the current month. Currently November is checked, but it needs to change to December when we get to next December and the report is refreshed.
I'm sure that the November boxed can't automatically be unchecked and the December box magically gets checked.
So I'm looking for any other options out there please!
I'm trying to keep it so the user doesn't have to click too many options to see the current month. I have thought of using a bookmark to show/hide current month, but I'm hoping for something better.
Many thanks for looking! 😊
Hi BarnyQuack
Using Tabular Editor, you need to levareage the Group by Columns property to "store a filter by using an alternate value, which represents the key of the entity." Power BI uses this key to store the filter, allowing the corresponding filter value in the visual to change dynamically. For instance, if May-24 is selected in the visual and currently has a key of 0, when June arrives, May will shift to a key of 1, and June will take the key of 0. Please note that if you're using a dropdown, although the filters have actually changed, the slicer selection doesn't.
Further reading in the video description: https://youtu.be/MrEAZREQuXM
6 Replies
- amitchandakSuper User
BarnyQuack , we usually use a current month text in a new column and use that as default
Need to be adjusted as per need
Month Type = Switch( True(),
eomonth([Date],0) = eomonth(Today(),-1*month(Today())),"Last year Last Month" ,
eomonth([Date],0) = eomonth(Today(),-1),"Last Month" ,
eomonth([Date],0)= eomonth(Today(),0),"This Month" ,
Format([Date],"MMM-YYYY")
)
Default Date Today/ This Month / This Year: https://www.youtube.com/watch?v=hfn05preQYA- BarnyQuackFrequent Visitor
Many thanks for the advice! That is much appreciated.
That is a great idea, My user wants to keep their date hierarchy i.e. year/quarter/month.
Is there a way to incorporate that?
- kushanNaSuper User
if amitchandak 's suggested solution works for you, you can create three separate columns: one for the Year, one for the Quarter, and one for the Month(suggested) in MMM format. Then, add all three columns to the slicer. It will display a hierarchy like Year → Quarter → Month(suggested)
oh and also you will need to create another column month in MM format to sort the suggested column
- danextianSuper User
Hi BarnyQuack
Using Tabular Editor, you need to levareage the Group by Columns property to "store a filter by using an alternate value, which represents the key of the entity." Power BI uses this key to store the filter, allowing the corresponding filter value in the visual to change dynamically. For instance, if May-24 is selected in the visual and currently has a key of 0, when June arrives, May will shift to a key of 1, and June will take the key of 0. Please note that if you're using a dropdown, although the filters have actually changed, the slicer selection doesn't.
Further reading in the video description: https://youtu.be/MrEAZREQuXM
- v-hashadapuCommunity Support
Hi BarnyQuack , Thank you for reaching out to the Microsoft Community Forum.
We find the answer shared by danextian is appropriate. Can you please confirm if the solution worked for you. It will help others with similar issues find the answer easily.
Thank you danextian for your valuable response.
- v-hashadapuCommunity Support
HI BarnyQuack , Hope you're doing okay! May we know if it worked for you, or are you still experiencing difficulties? Let us know — your feedback can really help others in the same situation.