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%)).

• ###### 1. Re: How to calculate a value over time given a parameter and daily percentage changes

Try

previous_value([Parameter])*(1+min([Daily Return]))

Thanks,

Shin

1 of 1 people found this helpful
• ###### 2. Re: How to calculate a value over time given a parameter and daily percentage changes

Hi Shin! Thanks that worked perfectly!

Only now I have a new problem.  I'd ideally like to also display the average value to allow for the comparison of different stocks over time.

I was thinking of using a formula such as { FIXED [Date]: AVG(previous_value([parameter]) * (1 + MIN([Daily Return])))}  but I'm running into an error that level of detail expressions can't contain table calculations. Is there any fix around this?

• ###### 3. Re: How to calculate a value over time given a parameter and daily percentage changes

Means this?

I don't have data, but you need to set table calculation appropriately based on your table structure.

(Without data, It cannot be clarified)

If this helped, could you mark my answer as "correct" to close the thread, not from inbox, but from original post.

Thanks,

Shin