johnstk
November 22nd, 2007, 03:56 AM
Trying to calculate Days In Stock value:
I have an opening quantity value (@fOpQtyBal) at the beginning of a period (displayed in Group header). Detail section lists all quantity movements for the period by date. I need to calculate the number of days that there is positive stock (Balance > 0).
Data looks like this:
Qty Balance
fOpQtyBal 10 10
01/01/2007 -1 9
03/01/2007 -9 0
10/01/2007 6 6
Days in stock is 31 days in January less 7 days (03/01 - 10/01) where there was no stock = 24.
Have tried a few ideas but get stuck on looping through the days because there are some days where there are no records. Any heads up?
I have an opening quantity value (@fOpQtyBal) at the beginning of a period (displayed in Group header). Detail section lists all quantity movements for the period by date. I need to calculate the number of days that there is positive stock (Balance > 0).
Data looks like this:
Qty Balance
fOpQtyBal 10 10
01/01/2007 -1 9
03/01/2007 -9 0
10/01/2007 6 6
Days in stock is 31 days in January less 7 days (03/01 - 10/01) where there was no stock = 24.
Have tried a few ideas but get stuck on looping through the days because there are some days where there are no records. Any heads up?