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
Anonymous
Not applicable

Dynamic date slicer that selects all months up to the current month

I have a date slicer that selects the month. Every month I go in and change the default to include all months up to the current month. So in March, the default for the slicer has January, February, and March included. I change the slicer default manually each month. I'm wondering if there is a DAX statement that can make the filter automatically select all months up to and including the current month. Thanks!

 

asodie_0-1673014679022.png

 

2 REPLIES 2
tmack99
Advocate II
Advocate II

The slicer can be made to automatically choose all months up to and including the current month by using a DAX statement, yes. To accomplish this, you must create a calculated column that first determines the current date using the TODAY() function and then returns the month of the current date using the MONTH() function. Then, using the FILTER() method, you can choose all entries with a month that is less than or equal to the one you are currently seeing. Last but not least, you can utilize this calculated column as the slicer's filter.

 

amitchandak
Super User
Super User

@Anonymous , I doubt that. You need a column like this in your table

 

if( month([Date]) <= month(today()), "Less than Current Month", format([date],"mmmm") )

 

and use that in filter

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.

Top Solution Authors