The reason why you continue to get the wrong answer is that the way the data is detailed.
You have both dates and both values on the same line of data, so the calculation you are processing, is actually giving the correct results as Value 1 is over 0. the elseif will never trigger.
If you structure the data like this
Date Value1 Value2
Then the response you can get is the following.
Is this what you are expecting to achieve?
Many thanks for the quick response! Your answer is 100% correct - however, I was hoping to avoid restructuring the data.
I guess there is no way to my the calculation work with the current data?
I have been playing with your example and its not immediately clear without amending the underlying data structure.
The Dates are separate which is where the issue lies, you are trying to run it along one date axis but you have 2 and the calculation does not allow for this.
If you have the ability to change the underlying data then I would try that first. You can always create a separate field to distinguish the dates also if needs be.
Thanks a lot!