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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
ssesham
Helper I
Helper I

Setting slicer to current Month & Year (September 2024)

Hi All,

 

I am looking for a help to setup date slicer to current month and year like (September 2024) as shown below. Any advice please..!

 

ssesham_0-1725674821193.png

 

8 REPLIES 8
ssesham
Helper I
Helper I

Any advice much appreciated please..!

Hi @ssesham ,

 

I have below things need to confirm with you.

You mean you don't have September 2024 in your slicer, but you want to show it, right?

Maybe you filtered out the September 2024 dates because of the other filters, but you still want the slicer to show September 2024, right?

If this is the case above, then the workaround is to create a separate date table that is not related to other tables.

Then create measures as visual-level filters to filter the other tables for the new date slicer created from the new separate data table.

You can create this date table as follows.

date table = ADDCOLUMNS(CALENDAR(DATE(2024,1,1),EOMONTH(TODAY(),0)),"MonthYear",FORMAT([Date],"mmmm yyyy"),"sort",FORMAT([Date],"yyyymm"))

vstephenmsft_4-1727075638297.png

 

There' a meaure as the visual-level filter in the table visual. The monthyear slicer is created from the date table. The relative date slicer is created from the main table.

vstephenmsft_3-1727075620584.png

 

 

 

 

Best Regards,

Stephen Tao

 

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

 

Hi @v-stephen-msft  thanks for taking time to reply. 

It's not about showing the filter for "Sept 2024". I want date slicer to be defaulted always current month. 

Hi @ssesham ,

 

If you want a default selection always displaying the current month in the slicer, you can do as follows.

Create a calcualted column in the date table.

Date 2 = 
VAR _currentmonthyear = FORMAT(TODAY(),"mmmm yyyy")
RETURN
IF (_currentmonthyear=[MonthYear]
,
"CurrentMonth",[MonthYear])

vstephenmsft_0-1727319041001.png

Use this calculated column to create a slicer. When you select the current month and the next time you open the report, the report defaults to the value for the current month.

vstephenmsft_1-1727319375304.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Another workaround is to use the "Preselected Slicer" visual in Power BI, which allows you to determine which values users must select when opening a report based on another column or measure.

Here's the blog about the default value slicer, please refer to

How to dynamically select the default values we ne... - Microsoft Fabric Community

 

Best Regards,

Stephen Tao

 

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

 

 

Thank you so much, much appreciated your effort, my existing dashboard filter is not straight forward, I have custom date range filter which is already in place.  If i remove the measure col as shown in pic from the detail section, the filters will not work. I agreed that your solution that works well if there is no custom filter. By any chance can we make this default month to work in this situation?

 

ssesham_0-1727326778745.png

 

Idrissshatila
Super User
Super User

Hello @ssesham ,

 

as @lbendlin  mentioned you need to create a column that will show you what's the current year and month and this would be current month else show the months.

 

ive done something like this for current date https://youtu.be/kVcStgZhnuw?si=VjFJIK_CSrvKaHHP

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




lbendlin
Super User
Super User

General pattern (adjust to your needs):
- create a string representation of your date column, replace the latest date with a string "Latest"
- sort that new column by the original date column
- add a slicer or visual/page/report level filter
- set the filter to "Latest"
- publish the pbix to the workspace/app

Thanks @lbendlin , But the issue is i have customized filter whenever i am using new column that refers the customize filter then it filters the record. 

ssesham_0-1725841610230.png

 

If i remove the column that has shown in below pic from the visual filters does not work, even though i have created relationship using (1:M)  or (M:M) the dates between two table (one from date filter  and other one from detail table  which has date).

ssesham_1-1725841923765.png

 

So i am confused why it's not working. otherwise i can apply your solution for the default date.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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