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
easyGG59
New Member

Months filter segment - Do not show the future months

Hi everyone,

 

I have created a segment with the different months of the year and I have an other one with the years. What I'm trying to do it is when I select 2020, I can select all the months from January to December. But when I select 2021, the month segment have to only show the current and passed months base on the current date. For exemple, today, the 02/02/2021, the segment would only show the months January and February.

 

Thank you for your help.

 

Gaspar

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi  @easyGG59 ,

 

Create a measure as below:

 

measure = IF(SELECTEDVALUE('Year Table'[Year])<>YEAR(TODAY()),1,
 IF(SELECTEDVALUE('Year Table'[Year])=YEAR(TODAY()),
 IF(MAX('Month Table'[Month])<=MONTH(TODAY()),1,BLANK())))

 

Then put the measure in the filter pane of month slicer,and choose measure is not blank:

v-kelly-msft_2-1612421855364.png

Finally you will see:

v-kelly-msft_0-1612421159413.png

v-kelly-msft_1-1612421734551.png

 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

View solution in original post

3 REPLIES 3
v-kelly-msft
Community Support
Community Support

Hi  @easyGG59 ,

 

Create a measure as below:

 

measure = IF(SELECTEDVALUE('Year Table'[Year])<>YEAR(TODAY()),1,
 IF(SELECTEDVALUE('Year Table'[Year])=YEAR(TODAY()),
 IF(MAX('Month Table'[Month])<=MONTH(TODAY()),1,BLANK())))

 

Then put the measure in the filter pane of month slicer,and choose measure is not blank:

v-kelly-msft_2-1612421855364.png

Finally you will see:

v-kelly-msft_0-1612421159413.png

v-kelly-msft_1-1612421734551.png

 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

Hi @v-kelly-msft 

Thank you for your solution, it works well !

 

@amitchandak Sorry, but I did not success to make it works. Maybe it could if I was a better user of PBI desktop.

 

Thank you to both you anyway.

 

Gaspar

amitchandak
Super User
Super User

@easyGG59 , usually when you select data, what dates do not have data that will not show 

 

You can try a measure like, assuming year is selected from a date table

 

0 between range
new Measure = var _1= [measure]+0
var _min = minx(ALLSELECTED('Calendar'), 'Calendar'[Date])
var _max = maxx(ALLSELECTED('Calendar'), 'Calendar'[Date])
return
CALCULATE(if(max('Calendar'[Date]) <_min || max('Calendar'[Date]) >_max , BLANK(), _1))

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.