Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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
Solved! Go to Solution.
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:
Finally you will see:
For the related .pbix file,pls see attached.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
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:
Finally you will see:
For the related .pbix file,pls see attached.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
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
@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))
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 38 | |
| 36 | |
| 30 | |
| 28 |
| User | Count |
|---|---|
| 128 | |
| 88 | |
| 79 | |
| 67 | |
| 62 |