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
jasemilly
Helper III
Helper III

calculated column show how many years ago non calendar year

Hi I have a datetable, that haddles years that dont run calendat year.  The year start 01/04/2020 for this year and I have a coumn called RailYear.  I would like to create a new calculated column that will show how many years ago that row is 

 

so for today 26/06/2020 years ago is 0

                    26/06/2019 years ago is 1

 

at the moment I have hardcoded the caluclated column so railyear - 2020 this works fine.

I have created a table current rail year that hold one value 2020, can I write a dax query that retrieves this value?  I have no realtionship between the tables ?

 

I am looking to use this value on a clustered graph so the the legend will dynamically change colour so each year ago is a certain colour.

thanks in advance  

0 REPLIES 0

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.