Forum Discussion

ARob198's avatar
ARob198
Helper IV
6 years ago

Dynamic Year Calculation

Hello,  I am trying to create a measure that calculates the number of years between two dates based on a value. 

 

I have been using the following measure: 

Years C = if([Value] <=0, 0, (([Date] - DATE(2016, 12, 31)) / 365))
 
However, I would like to modify this so that when the value is greater than 0, that date is pulled instead of Dec 31, 2016.
 
So for example, if the value of June 30, 2017 starts to be a positive number, I would like the calculation to be ([DATE] - June 30, 2017) /365.
 
How can I code this so that the measure is dynamic?
 
Thank you very much

2 Replies