Forum Discussion

ThornTech's avatar
ThornTech
Frequent Visitor
4 years ago
Solved

Tracking peak Equity over time

I am working on a dashboard where I need to track the max value from the start of the data to now. The dataset has multiple strategies in it denoted by "StratID" (1000000, 2000000, 3000000, etc...

When I have a single strategy the formula below works fine, however, once I have multiple strategies I can't think of a way to make sure the Lookback period only goes to trade 1 of the current set.

It's like I need to group via the stratID apply the Max calc and then expand it back out.

I can do this via a measure as filters will separate out the values, but I really want it in the columns for other analysis I need to do down the line.

Any help would be great.

 

 

 

 

 

C_Peak Strat = 
CALCULATE (
    max ( [Balance] ),
    all(History),
    History[Trade ID] <= EARLIER ( History[Trade ID])
)

 

 

 

 

 



A sample of the data is below. Thanks
StratIDTrade IDBalance
10000001

10000

1000000210010
1000000310100
1000000410090
1000000510300
1000000610290
2000000120000
2000000220100
2000000320150
2000000420099
2000000520095
2000000620145
2000000720300
2000000820250
  • You can use ALLEXCEPT,

    C_Peak Strat =
    CALCULATE (
        MAX ( [Balance] ),
        ALLEXCEPT ( History, History[StratID] ),
        History[Trade ID] <= EARLIER ( History[Trade ID] )
    )
    

2 Replies

  • You can use ALLEXCEPT,

    C_Peak Strat =
    CALCULATE (
        MAX ( [Balance] ),
        ALLEXCEPT ( History, History[StratID] ),
        History[Trade ID] <= EARLIER ( History[Trade ID] )
    )
    
  • ThornTech's avatar
    ThornTech
    Frequent Visitor

    So simple when you know. Worked a treat, thanks for the quick reply.