Forum Discussion

vencenz's avatar
vencenz
Regular Visitor
8 years ago
Solved

STDEV and VAR for Date Period

Hoping a kind soul could help with formula for calculating StDev and Variance of portfolio returns for a given trailing period (ie last 12-months or 3-years). I've tried using STDEV.P and defining th...
  • v-ljerr-msft's avatar
    v-ljerr-msft
    8 years ago

    Hi vencenz,

     

    Based on my test, the formula below should work in your scenario. :smileyhappy:

    StDEV_1 =
    VAR year =
        YEAR ( MAX ( return_table[Date] ) )
    RETURN
        CALCULATE (
            STDEV.P ( return_table[Return (Month)] ),
            FILTER (
                ALL ( return_table ),
                YEAR ( return_table[Date] )
                    >= year - 1
                    && NOT ( ISBLANK ( return_table[Return (Month)] ) )
            )
        )
    

    Regards