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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Stuznet
Helper V
Helper V

Filter By Year Dynamically

Hi,

 

I ran into a dead end that I like my graph display the Year from Current Year and to the following 5 consecutive year (2018-2022) dynamically without having me filter or slice it manully each time.

2018-10-30_14-05-11.jpg

 

Here is the function I wrote. Then I dropped it into tooltips and filtered it by 1.

Column = IF([Year] >= YEAR(NOW()),"Future Year","")

Can someone help me?

8 REPLIES 8
marcoslopez
Helper I
Helper I

Hi @Stuznet, you could create a calculated column that shows 0 if year(date) < year(today) and the value with future dates.

Hope this help you, apologies for my bad english Smiley Happy

Best Regards, Marcos

@marcoslopezthank you for your input. I tried your suggested function.

Column = IF(YEAR([Date]) < YEAR(TODAY()),1,0)

I'm getting the same result as it shown on the chart from above. 

Hi @Stuznet,

 

Please add below measure to visual level filters and set its value to 1.

CheckMeasure =
IF ( YEAR ( SELECTEDVALUE ( Table[Date] ) ) >= YEAR ( TODAY () ), 1, 0 )


Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yulgu-msftI've tried the function you provided, unfortunately it is not the result I'm looking for. 

I filtered is "1".

.2018-10-31_8-34-03.jpg

2018-10-31_8-28-52.jpg

 

I would like to see the result from 2018 to 2023 like it shown below the chart.

2018-10-31_8-31-37.jpg

 

And so for next year start from 2019 to 2024. 

 

Thank you for your help.

Hi @Stuznet,

 

Please change the X-axis type from categorical to continuous for a test. If it still doesn't work, please share your .pbix file so that I can check for you.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

That I said was sth like having Column Total Invoices then 
New Calculated Column:
Total Estimated Invoices =
    if (
         year(InvoiceDate) >= year( today() );
         Total Invoices;
         0
        )

@marcoslopezI tried that and it giving false result.

Column = IF(YEAR([Date]) >= YEAR(TODAY()),[Total],0)

2018-10-30_15-34-22.jpg

Last 6 Years Filter = IF(AND(YEAR([Date]) >= YEAR(TODAY()) - 6,YEAR([Date}) <= YEAR(TODAY()) + 2), YEAR([Date}), 0 )
 
this is what iwe have to create a dynamic filter that looks at previous 6 years and future 2 years. Future dates as i use it in a forecast graph. Add it as a calculated column and apply as a filter, conditions for filter = 'is not 0'

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.