3 Replies Latest reply on Nov 7, 2018 9:51 PM by Shinichiro Murakami

How to calculate a value over time given a parameter and daily percentage changes

Hi all, I have a finance question that I surprisingly wasn't able to find resources on.

I have a set of daily stock price percentage changes, one day it's up x% the next day it's down y%, etc. I'd like to create a parameter that let's a user input the value they'd like to invest, and see how that value would have grown over time.  Seems easy enough, right?

I created a calculated field: [parameter] * (1 + [Daily Return])

But it  takes the parameter as the starting point every time. How do I have it take the parameter as the starting point the first time, and then each subsequent day take the previous day's calculation as the starting point? So each calculation uses the previous day's calculation as an input.

Example. Day 1 starts with \$1 and it goes up 1% leaving me with \$1.01 (1 * (1 + 1%)).  The next day it goes down 1% leaving me with \$.9999999 (1.01 * (1 - 1%)).