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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Solans
Regular Visitor

Need help with Previous Month selector, selecting December

Hello,

 

I have a slicer on my visuals selecting the previous month, therefore excluding the current month.

Now, the problem occurs when the new year begins. As you can guess the slicer will select Demcember as the last month and the visual will stay on 2022.

What I've done is that I created a slicer that will always select the current year. Will this solve this problem, or is there anyhting else I need to do?

 

The code:


Latest Month =
if(
month(today()) -1 = month(Date_Table[Date]) ,
"Vorige maand",
Date_Table[Month Name]

 

And

 

Current Year =
IF(
'Date_Table'[This Year] = 'Date_Table'[Year],
"Huidig jaar",
FORMAT('Date_Table'[Year], "General Number")
)

 

 

2 REPLIES 2
amitchandak
Super User
Super User

@Solans , Based on what I got. It would better to have month year slicer like

 

Month Type = Switch( True(),
eomonth([Date],0) = eomonth(Today(),-1*month(Today())),"Last year Last Month" ,
eomonth([Date],0) = eomonth(Today(),-1),"Last Month" ,
eomonth([Date],0)= eomonth(Today(),0),"This Month" ,

eomonth([Date],0)= eomonth(Today(),-1*month(Today()) ),"Last Dec" ,
Format([Date],"MMM-YYYY")
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi,

 

Thanks for your reply, however this doesnt seem to work as intended.

 

For reference, I am trying to use the slicer on two visuals that show the count of tickets.

The first visual has to show the count of tickets for 2 different departments and for every month of this year.

The second visual shows the count of total tickets of the current year (of completed months) in comparison with last year.

Now the problem I have is that when it is Januari, the month selected is then December, The visuals then show the data of 2022, and I have to manually update the year to the next.

Picture for reference:

Solans_0-1679934083819.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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