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
MacJasem
Helper II
Helper II

How to set a default selection on your date slicer, that is Dynamic.

Hi all

I've got this month slicer on a report page that shows the Months from my date table, then i've entered a Page filter so that it only shows the Months in this year, and this slicer expands as we move into new months of the year. 

I wish to have the last/newest month selected per default in the Month slicer. 

Any ideas on how i can set a default selection on my Month Slicer, that is always the last available month on the slicer?

1 ACCEPTED SOLUTION
v-xinruzhu-msft
Community Support
Community Support

Hi @MacJasem 

You can use the customm visual:preselected slicer, it can set the dafault selection.

vxinruzhumsft_0-1697174356015.png

You can refer to the following sloution.

1.You need to create a table to set the true or false value.

vxinruzhumsft_1-1697174536035.png

 

2.Then you can create a measure to select the max month

Measure = var a=MAXX(ALLSELECTED('Table'),[Month])
return IF(SELECTEDVALUE('Table'[Month])=a,TRUE(),FALSE())

3.Then put the meaure and the true/false table to the slicer field

vxinruzhumsft_2-1697174823951.png

 

Output

vxinruzhumsft_3-1697174835370.png

Best Regards!

Yolo Zhu

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

4 REPLIES 4
v-xinruzhu-msft
Community Support
Community Support

Hi @MacJasem 

You can use the customm visual:preselected slicer, it can set the dafault selection.

vxinruzhumsft_0-1697174356015.png

You can refer to the following sloution.

1.You need to create a table to set the true or false value.

vxinruzhumsft_1-1697174536035.png

 

2.Then you can create a measure to select the max month

Measure = var a=MAXX(ALLSELECTED('Table'),[Month])
return IF(SELECTEDVALUE('Table'[Month])=a,TRUE(),FALSE())

3.Then put the meaure and the true/false table to the slicer field

vxinruzhumsft_2-1697174823951.png

 

Output

vxinruzhumsft_3-1697174835370.png

Best Regards!

Yolo Zhu

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

 

 

Ritaf1983
Super User
Super User

Hi @MacJasem 

if you don't need the list of months you can use form option of "related date" on slicer :

Ritaf1983_0-1696690411028.png

if you are working with a month list you can use the linked workaround :
https://www.youtube.com/watch?v=5dN4SqufENE

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

Hi @Ritaf1983 

Thanks for the input👍

But that is not really what i'm looking for. 
I already have set up the calculations to handle the dates as in the youtube video you linked to, but the only thing that i'm missing is how to set the default selection of the slicer to dynamically be the last date available in the slicer.

So now the last month of the slicer is October, and i've clicked on October to select the month. I'd like the selection to be done by default and dynamically change to the last month in the slicer. So that next month when we enter November, the slicer will be extended with a new month and that month should now be selected by default.

MacJasem_0-1696695591036.png

Any idea on how to do so?


BTW.
- in your screenshot you have the option to chose the slicer to be a relative view, and that's not the case in my desktop🤷‍♂️

MacJasem_1-1696695900938.png

 

Hi @MacJasem 
1. you need to have the "current month" ( not its name ) that is exactly what the video tutorial shows how to modify. 
Then you click on it when you publish or select from the list and it will be kept.
The second option - it seems you put the month column and not the date column to the slicer:

Ritaf1983_0-1696703187339.png

you need to put there column with date data type ( not string)

 

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

 

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.