Calculating running MAX() for a Measure ?

mystic2k

New Member
Joined
Nov 2, 2006
Messages
27
Hello all,

For the record, I'm a complete PP/DAX newbie. I'm starting to use it to analyze large (can be over 10 million rows) but extremely simple datasets (backtesting of investment strategies). I'm typically working with 1 single table, which looks like this:

[obsdate] | [strategy] | [parameter A] | [parameter B] | [pl_daily]

I've setup a cumulative total since inception using the following formula:

Code:
pl_cum=CALCULATE(SUM(tblSource[pl_daily]),FILTER(ALL(tblSource[obsdate]),tblSource[obsdate]<=MAX(tblSource[obsdate])))

Now I'd like to calculate the Max of cum_pl for each day. I've tried using the same approach as above :

Code:
pl_max=CALCULATE(MAX(tblSource[pl_cum]),FILTER(ALL(tblSource[obsdate]),tblSource[obsdate]<=MAX(tblSource[obsdate])))

But apparently the MAX() function does not work with Measures. I've messed around with MAXX() but I'm not really sure I understand how it works. Can anyone help me out with that please?

I need this value to calculate the current drawdown (i.e. [current day's cumulative P&L] - [max of cumulative P&L to date]). Maybe there's another way to achieve that result?

Any suggestions are most welcome, thanks in advance for your help!
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,223,984
Messages
6,175,786
Members
452,670
Latest member
nogarth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top