3 Replies Latest reply on Dec 4, 2013 2:41 PM by George Nguyen

Calculating Return on Investment

I have the table with two columns: date and monthly return rate

I want to calculate the return on my investment - which started at \$10,000.

I can calculate and visualize the cumulative return rate by doing a quick table calculation for Running Total on the measure (Monthly Return Rate). But this is not what I want.

I want to calculate the current return value on my investment based on the previous return value. So the graph would show the following:

I've attached the workbook as well as the Excel file with the underlying data (which also includes my calculations using both methods)

Thanks!

• 1. Re: Calculating Return on Investment

Is this close:

The calc was

if index() = 1 then 10000*(1+attr([Monthly Return Rate])) else previous_value(1)*(1+attr([Monthly Return Rate])) end

You can set the "10,000" to whatever value you want if you use a parameter instead of hard-coding it like I did.

• 2. Re: Calculating Return on Investment

You cannot do this without having an Investment value stored in the data to begin with.  If you've got the data in an Excel sheet pre-calculated, why not just bring that data into Tableau?  I simply copied and pasted your data into a new sheet, and could display what you wanted in an instant:

I'm not sure what exactly you are trying to do, but you cannot create this view without having an investment value stored somewhere in the data.

• 3. Re: Calculating Return on Investment

Thanks, Aaron Clancy! I wrote a similar formula, but used SUM instead of ATTR.