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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Pbiuserr
Post Prodigy
Post Prodigy

Slicer to show always current month-year

Hello,

I try to build slicer which would show always current month-year when someone enters the report.

Currently I've build the calculated column in my calendar table which looks like that

 

Current Month =
IF(MONTH(Date[Date]) = MONTH(TODAY()) && YEAR(Date[Date]) = YEAR(TODAY()), "CurrentPeriod", Date[Year-Month])
 
Is it good approach? Seem to work good, but when the date reaches March, will it switch to march, and If i save slicer to show "CurrentPeriod", will it highlight march dates?
 
Moreover, my calendar date goes till the end of the year, so there are months which are not available with the data right now. To limit that and show only dates till current period, I've made a flag
 
Datafilter = IF (Date[Date] > TODAY(), 0, 1)
and I've set it as a filter on a slicer with "Datafilter is 1"
 
Seems to work as well, however I'd like to list my months in slicer continouesly so from start to the end month by month, currently I've got something like
 
01 2020
01 2021
01 2022
02 2020
02 2021
02 2022
03 2020
03 2021
04 2020
04 2021
... all the way to 12.2021 
CurrentPeriod
 
I'd like it to go
All 2020 months
All 2021 months
All 2022 months till Current Period
 
Any tips on that?
1 ACCEPTED SOLUTION

Hello,

I've resolved problem myself

Jaki okres = Switch( True(),
eomonth(Date[Date],0) = eomonth(Today(),-1),"Last period" ,
Format(Date[Date],"MM YYYY")
)

 

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Pbiuserr , Yes, the approach is good, we do not have another approach as of now

 

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

 

 

For last one you have use a filter like this one

Month Type = Switch( True(),
eomonth([Date],0) <= eomonth(Today(),-1),"Previous Months" ,
"Furure Months"
)

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

@amitchandak  Thanks for your input first column works brilliantly, although I dont understand second column intended use 

 

This suppose to filter my calendar which is 

VAR MaxYear = Year(MAX('data'[CREATED]))
VAR MaxDate = DATE(MaxYear, 12, 31)
till MaxYear of variable all the way to the 31.12.MAXYEAR
 
and I want limit it to finish at "This Month" dynamically, so user can't select for example 01.05.2022 because it has no data. I want it to vanish from the slicer, just to be able to filter from 01.2020 to current month in order so first goes 2020 months then 2021 then 2022 and finish with Current Month 

hope I am clear enough if you want more in depth description just let me know and thanks for your time again!

Hi @Pbiuserr ,

 

Please create the calculated column.

 

Order = FORMAT ( [Date], "yyyymm" )

vkkfmsft_0-1645081492280.png

 

Then sort [Current Month] column by [Order] field.

 

vkkfmsft_1-1645081545699.png

vkkfmsft_2-1645081559163.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hello,

I've resolved problem myself

Jaki okres = Switch( True(),
eomonth(Date[Date],0) = eomonth(Today(),-1),"Last period" ,
Format(Date[Date],"MM YYYY")
)

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors