You're going to have to use a manual running total. It's not hard, but it will be a bit tricky if you aren't familiar with writing formulas. Here is something quick I wrote that might get you started in the right direction. It will probably be off by a day or two, but you can test it and tweak it to get it right.
Global NumberVar Balance;
Global NumberVar DaysInStock;
Balance := Balance + {qty};
if Balance > 0 Then
DaysInStock := DaysInStock + DateDiff("d", {fOpQtyBal}, PreviousValue(fOpQtyBal});
If you are looking for more information on all the CR functions and how to write formulas, my CR Encyclopedia book has over 50 pages to help you understand program and debug them.
Edited by BrianBischof - 22 Nov 2007 at 1:36pm