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

How to set slicer default value of current month?

Hi Team,

 

My report displaying published month in slicer. Next month automatically need to change, But not changing .

 

Could you please help me, How to set Slicer default selected value is Current month. 

Slicer.PNG

 

Thanks in advance for your help.

 

Regards,

Sriram e

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

I created two calculated columns like this.

Month = [Date].[Month]
Mark_Month = 
IF(
    [Date].[MonthNo] = MONTH( TODAY() ) && [Date].[Year] = YEAR( TODAY() ),
    "Current month",
    "Not current month"
)

And add the two calculated columns to the slicer visual.

v-lionel-msft_0-1594632606570.png

Each time the dataset is refreshed, the current month in the dataset is marked, and the default value of the slicer is always the current month.

 

Best regards,
Lionel Chen

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

9 REPLIES 9
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please refer to my .pbix.

Set the default value of the slicer to the current month. As the date column is updated, the default value of the slicer will always be the current month.

 

r1.PNG

 

Best regards,
Lionel Chen

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

Anonymous
Not applicable

Thanks for your response. Im unable to open your Power BI report. Getting error below error.

Sriram_86_0-1594360177968.png

 

 

 

Hi @Anonymous ,

 

I created two calculated columns like this.

Month = [Date].[Month]
Mark_Month = 
IF(
    [Date].[MonthNo] = MONTH( TODAY() ) && [Date].[Year] = YEAR( TODAY() ),
    "Current month",
    "Not current month"
)

And add the two calculated columns to the slicer visual.

v-lionel-msft_0-1594632606570.png

Each time the dataset is refreshed, the current month in the dataset is marked, and the default value of the slicer is always the current month.

 

Best regards,
Lionel Chen

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

 

 Thank you @v-lionel-msft , I was able to use that.

In the hierarchy I noticed that the selected month name becomes unreadable while using the drop down view, so I adjusted your solution to the following:

Mark_Month = 
IF(
    [Date].[MonthNo] = MONTH( TODAY() ) && [Date].[Year] = YEAR( TODAY() ),
    [Date].[MonthName], //the current Month Name istead of "Current month"
    "Not current month"
)

and it looks like that:

Default Month.JPG

 

BR, Roman

amitchandak
Super User
Super User

@Anonymous , In my Date table I create a month Name like this and select current month in Slicer

 

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

 

I also sort this on

Format([Date],"YYYYMM")

 

https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column

 

You can default value in slicer by function

Anonymous
Not applicable

@amitchandak Thanks for your response. I dont have Calender table. My Main table have Date column. Is it possible to use my Main table Date column. if not possible please let me know, How to create Calender table. 

 

If you have any sample report, Please share.

 

Regards,

Sriram

harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

 

Please check if this solution works for you. (pbix file is attached)

 

https://community.powerbi.com/t5/Desktop/Setting-the-Default-Value-of-a-Slicer/m-p/16442

 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

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.