Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
petrosk
Frequent Visitor

Calculating Investment Rate of Return in Power BI

I have a Fact Table of Net Asset Values (NAV) for investments over time.  My objective is to calculate the Rate of Return (ROR), based on a user-defined start date and end date.  The ROR depends on the start date, end date, and investment changes during the period being analyzed.  For simplicity, the model excludes the effect of dividends.  I have also copied/pasted below the key formulas along with a mock-up of the Fact Table.  The last column, entitled NAV T-1 Month, is calculated.  My Questions:

 

  1. How might I adapt the model and/or formulas so the user can define the start date and end date? Would variables work for this purpose?
  2. How might I create formulas to calculate the 1-month, 6-month, and 12-month rate of return?

 

Any help from the community would be greatly appreciated.

 

NAV T-1 Month = LOOKUPVALUE(FactFundNAV[NAV],FactFundNAV[Date],PREVIOUSMONTH(FactFundNAV[Date]),FactFundNAV[Fund Code],FactFundNAV[Fund Code])

 

Delta = IFERROR((CALCULATE(SUM(FactFundNAV[NAV]))-CALCULATE(SUM(FactFundNAV[NAV T-1 Month])))/CALCULATE(SUM(FactFundNAV[NAV T-1 Month])),Blank())

 

ROR = EXP(SUMX(FILTER(ALL( FactFundNAV[Date] ),FactFundNAV[Date] <= MAX( FactFundNAV[Date])),LN(1+[Delta])))-1

 

DateFund CodeNAVNAV T-1 Month
12/31/2014A8.14 
12/31/2014B27.15 
12/31/2014C20.63 
1/30/2015A8.198.14
1/30/2015B26.7127.15
1/30/2015C20.6520.63
2/27/2015A8.358.19
2/27/2015B28.0626.71
2/27/2015C21.920.65
3/31/2015A7.878.35
3/31/2015B26.4828.06
3/31/2015C21.0421.9
4/30/2015A7.947.87
4/30/2015B26.4326.48
4/30/2015C21.9521.04
5/29/2015A7.967.94
5/29/2015B26.8226.43
5/29/2015C21.921.95
6/30/2015A7.867.96
6/30/2015B26.0926.82
6/30/2015C21.321.9
7/31/2015A7.887.86
7/31/2015B26.5326.09
7/31/2015C21.0521.3
8/31/2015A7.87.88
8/31/2015B25.0726.53
8/31/2015C19.321.05
9/30/2015A7.647.8
9/30/2015B24.6125.07
9/30/2015C18.4919.3
10/30/2015A7.847.64
10/30/2015B26.6724.61
10/30/2015C20.2318.49
11/30/2015A7.737.84
11/30/2015B26.7626.67
11/30/2015C20.3320.23
12/31/2015A7.597.73
12/31/2015B26.6426.76
12/31/2015C19.820.33
1/29/2016A7.517.59
1/29/2016B24.9726.64
1/29/2016C18.2319.8
2/29/2016A7.557.51
2/29/2016B24.6924.97
2/29/2016C17.9218.23
3/31/2016A7.357.55
3/31/2016B25.1624.69
3/31/2016C18.7317.92
4/29/2016A7.547.35
4/29/2016B25.0425.16
4/29/2016C19.1218.73
5/31/2016A7.547.54
5/31/2016B25.8125.04
5/31/2016C19.119.12
6/30/2016A7.597.54
6/30/2016B25.2425.81
6/30/2016C18.8719.1
7/29/2016A7.757.59
7/29/2016B26.8625.24
7/29/2016C19.9318.87
8/31/2016A7.897.75
8/31/2016B27.1826.86
8/31/2016C20.3419.93
9/30/2016A7.937.89
9/30/2016B27.6627.18
9/30/2016C20.9220.34
10/31/2016A7.957.93
10/31/2016B26.8627.66
10/31/2016C20.2820.92
11/30/2016A7.897.95
11/30/2016B27.8726.86
11/30/2016C19.4620.28
12/30/2016A7.997.89
12/30/2016B28.3627.87
12/30/2016C19.5319.46
1/31/2017A8.087.99
1/31/2017B29.2428.36
1/31/2017C20.9419.53

 

1 ACCEPTED SOLUTION
v-ljerr-msft
Employee
Employee

Hi @petrosk,

  1. How might I adapt the model and/or formulas so the user can define the start date and end date? Would variables work for this purpose?

Using variables could be an option. The formula below is for your reference. 

ROR = 
VAR maxSelectedDate =
    MAX ( FactFundNAV[Date] )
VAR minSelectedDate =
    MIN ( FactFundNAV[Date] )
RETURN
    EXP (
        SUMX (
            FILTER (
                ALL ( FactFundNAV[Date] ),
                FactFundNAV[Date] <= maxSelectedDate
                    && FactFundNAV[Date] >= minSelectedDate
            ),
            LN ( 1 + [Delta] )
        )
    )
        - 1
  1. How might I create formulas to calculate the 1-month, 6-month, and 12-month rate of return?

If I understand this correctly, the formula below may do it in a simple way.Smiley Happy

1 Month ROR = 
VAR maxDate =
    CALCULATE ( MAX ( FactFundNAV[Date] ), ALL ( FactFundNAV ) )
RETURN
    EXP (
        SUMX (
            FILTER (
                ALL ( FactFundNAV[Date] ),
                FactFundNAV[Date] <= maxDate
                    && FactFundNAV[Date]
                    >= maxDate - 30
            ),
            LN ( 1 + [Delta] )
        )
    )
        - 1

Regards

View solution in original post

2 REPLIES 2
v-ljerr-msft
Employee
Employee

Hi @petrosk,

  1. How might I adapt the model and/or formulas so the user can define the start date and end date? Would variables work for this purpose?

Using variables could be an option. The formula below is for your reference. 

ROR = 
VAR maxSelectedDate =
    MAX ( FactFundNAV[Date] )
VAR minSelectedDate =
    MIN ( FactFundNAV[Date] )
RETURN
    EXP (
        SUMX (
            FILTER (
                ALL ( FactFundNAV[Date] ),
                FactFundNAV[Date] <= maxSelectedDate
                    && FactFundNAV[Date] >= minSelectedDate
            ),
            LN ( 1 + [Delta] )
        )
    )
        - 1
  1. How might I create formulas to calculate the 1-month, 6-month, and 12-month rate of return?

If I understand this correctly, the formula below may do it in a simple way.Smiley Happy

1 Month ROR = 
VAR maxDate =
    CALCULATE ( MAX ( FactFundNAV[Date] ), ALL ( FactFundNAV ) )
RETURN
    EXP (
        SUMX (
            FILTER (
                ALL ( FactFundNAV[Date] ),
                FactFundNAV[Date] <= maxDate
                    && FactFundNAV[Date]
                    >= maxDate - 30
            ),
            LN ( 1 + [Delta] )
        )
    )
        - 1

Regards

GilbertQ
Super User
Super User

Hi @petrosk

 

What you are asking can certainly be done.

 

For Question 1, I would suggest that you create your measures that are independant of dates where they need to be. The reason for this is so that when the user selects a date range, the measure will then calculate on the fly based on the date range selected.

 

For Question 2, I would suggest that you can put in disconnected slicers, which can then filter your data based on what the user selects? Another option is to build in a period table, which can do this for you.

Here is a blog post: Create Dynamic Periods for Fiscal or Calendar Dates in Power BI

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.