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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Stuznet
Helper V
Helper V

Dynamic Forecast Year

Hi guys,

 

I have a Stacked Column Chart with Spend vs Fiscal Year data. The Total Amount columns are broken down into Category values. 

 

2018-10-26_15-26-23.jpg

 

How do I make it so that only the 5 Fiscal Year by Amount are shown in graph?, and so for next year 2019 will display 2019-2024 

 

2.jpg

I wrote this function, Column

YearRank= RANKX(FILTER(Table1,Table1[ColumnYear] = EARLIER(Table1[ColumnYear])),Table1[Amount],,DESC,Dense)

Then I create a another column

Column = IF(Table1[YearRank] <= 5, [ColumnYear],"Wrong Date")

but I'm getting an error

Expressions that yield variant data-type cannot be used to define calculated columns.


I appreciate any help! Thank you!

 

4 REPLIES 4
v-frfei-msft
Community Support
Community Support

Hi @Stuznet,

 

One sample for your reference.

 

1. Create a calculated table.

 

Table = GENERATESERIES(1899,2100,1)

2. Create a measure as below.

 

Measure = var y = SELECTEDVALUE('Table'[Year])
return 
IF(MAX(Table1[year])>=y && MAX(Table1[year])<=y+5,1,0)

3. Create the Stacked Column Chart and add the measure to tooltip and make the visual filterd by the measure.

Capture.PNG

 

For more details, please check the pbix as attached.

 

Regards,

Frank

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

@v-frfei-msftThank you for providing your solution however it doesn't seem to work for me. I followed what you did but I'm getting false result 

 

2018-10-30_9-46-04.jpg

Hi @Stuznet,

 

Did you select any value in the slicer?

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi @Stuznet,

 

Could you please share your pbix to me? You can upload the file to dropbox and share the line here.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

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