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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Danny_Stultiens
Frequent Visitor

Default last date in dropdown slicer with dates

Hi all,

 

My dashboard contains a dropdown slicer with a month value from the calender table to filter the visuals on the dashboard. I would like this dropdown slicer to automatically show the last month that is available in the calendar by default, but previous months must also stay available for the user to select.

 

At this moment, when a new month is added to the calendar table, it becomes available in the dropdown, but it keeps showing the original month as default.

 

I tried a few solutions that are mentioned within different forums, but they are all just a bit different then my case.

 

Can someone point me in the right direction to get this default date value dynamic?

 

Thanks a lot in advance!

 

With kind regards, 

 

Danny

1 ACCEPTED SOLUTION

Ok, found a solution; add a column to the calendar table. In there put a formula "if month column value is previous month, then "previous month" else give month value. Then put this column in the slicer and set default value to "previous month". Seems a long way around, but does the trick.

 

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Danny_Stultiens , A new column in date table

 

Month Type =
var _max = maxx(allselected(Fact), Fact[Date])
Switch( True(),
eomonth([Date],0) = eomonth(_max,-1),"Last Month" ,
Format([Date],"MMM-YYYY")
)

 

or

 

Month Type = Switch( True(),
eomonth([Date],0) = eomonth(Today(),-1),"Last Month" ,
eomonth([Date],0)= eomonth(Today(),0),"This Month" ,
Format([Date],"MMM-YYYY")
)

save on last month in slicer

 

Default Date Today/ This Month / This Year: https://www.youtube.com/watch?v=hfn05preQYA

Hi Amitchandak,

 

Thank you for your quick reply. I have no issue to find the last date/month (just with the max function). But my issue is to set the default value on the slicer to the max value in de calendar table.

 

I expect that the answer is in your last reply "save on last month in slicer", but I do not exactly understand what you mean. I would like to prevent me from opening and saving the dashboard to the last month every time there is new data. 

Ok, found a solution; add a column to the calendar table. In there put a formula "if month column value is previous month, then "previous month" else give month value. Then put this column in the slicer and set default value to "previous month". Seems a long way around, but does the trick.

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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