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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Nate_BI
Frequent Visitor

Dynamic Visualization Filters

I have a forecast report and want to publish it in a BI system. But, I want the Year range to start 5 years before the year which has complete records.  And I want to start the forecast line to ignore the last two years but in a filter. The reason why we wanted to use a dynamic filter instead of the usual common filters is that once the report is published, we aren't gonna have access to it. Can you give me ideas on how I can create a dynamic filter for my visualization?Forecast.png

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

Hi, @Nate_BI 

 

Based on what I've got, what you want to achieve is to get a range of 5 years before the last full year.
For example, if it's 2022 and the last full year is 2021, what you want to get is the five years before 2021, i.e. 2015 to 2020.
When it is now April 2023 and the last full year was 2022, you want to get is 2016 to 2021.

 

Try to create a measure like this:

_Range = 
var _maxDate=MAXX(ALL('Table'),[Date])
var _thisYear=YEAR(_maxDate)
var _completeYear=IF(_maxDate=DATE(_thisYear,12,31),_thisYear,_thisYear-1)

var _rangeMax=_completeYear-1
var _rangemin=_rangeMax-5

var _if=IF(SELECTEDVALUE('Table'[Date])>=DATE(_rangemin,1,1)&&SELECTEDVALUE('Table'[Date])<=DATE(_rangeMax,12,31),1,0)
return _if

Then filter the measure in filter pane.

Result:

vangzhengmsft_0-1648778229592.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-angzheng-msft
Community Support
Community Support

Hi, @Nate_BI 

 

Based on what I've got, what you want to achieve is to get a range of 5 years before the last full year.
For example, if it's 2022 and the last full year is 2021, what you want to get is the five years before 2021, i.e. 2015 to 2020.
When it is now April 2023 and the last full year was 2022, you want to get is 2016 to 2021.

 

Try to create a measure like this:

_Range = 
var _maxDate=MAXX(ALL('Table'),[Date])
var _thisYear=YEAR(_maxDate)
var _completeYear=IF(_maxDate=DATE(_thisYear,12,31),_thisYear,_thisYear-1)

var _rangeMax=_completeYear-1
var _rangemin=_rangeMax-5

var _if=IF(SELECTEDVALUE('Table'[Date])>=DATE(_rangemin,1,1)&&SELECTEDVALUE('Table'[Date])<=DATE(_rangeMax,12,31),1,0)
return _if

Then filter the measure in filter pane.

Result:

vangzhengmsft_0-1648778229592.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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