Forum Discussion
Dax Help
- 6 years ago
Well, never say never.
Behold:
IDA_m = 1+max('Table'[PX_Last])/10000 IDA_p = var d=max('Table'[As of Date]) return 10000000*PRODUCTX(filter(all('Table'),'Table'[As of Date]<=d),[IDA_m])
"by "Previous" I mean the value from previous day (same as previous row if placed in descending order by Date)"
You see, this is exactly where my confusion comes from. I would call that the NEXT row. The previous row is on top of the current row, and the next row is below it - at least in my cultural perception. (I also wouldn't put dates in descending order but that's probably just me)
Here is how I would start:
var d = max('Table'[As of Date])
var prev_d = calculate (max('Table'[As of Date]),ALL('Table'),'Table'[As of Date]<d)
That gives you the latest date before your filter context date.
And now it becomes really complex since your measure depends on itself. Most likely this will lead to some sort of circular reference.
Where does the starting value come from? is that the 10 mil under the July line?
lbendlin thanks for your input and yes you are right. That would be the next row. Dint realise we could see the same thing from either way, my bad.
Yeah the complex part would be tackling the circular reference.
The starting value (10 mil) was just entered manually in the spread sheet to start the base calculation. The first value will have to refer to this 10 mil in the calculation.
Thanks,
SV