Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
LaalBaadshah
Contributor
Contributor

How to obatain daily closing stock value (Recursive calculation)

Hi, 

I am facing difficulty while performing a recursive calculation to obtain daily closing stock, 

The problem is as follows, I have opening stock balance for day 1, daily sales qty, order qty(EOQ) and Safety stock qty, using which I have to obatin the closing stock qty for each day.

to calculate closing stock I check first 

if opening stock>safety stock then opening stock -daily sales

else  

opening-daily sales+EOQ

endif

form day 2 onwards the opening stock value will be the closing stock calculated for day 1, i.e.  to calculate closing stock of any days other than day 1, previous day's closing stock must be used as opening stock.

See table 1

I have tried using above function but since it works on existing fields only, it did not gave any solution

DayOpening StockDaily SalesEOQSafety StockClosing Stock
19010307080
29010307070
390103070100
49010307090
59010307080
69010307070
790103070100

 

1 Solution

Accepted Solutions
sunny_talwar

I think, for third row you should have a closing stock of 90 because your starting is 70 and the daily sales is 10... making is 60 and plus 30 = 90

May be try these expressions

Opening Stock
=Alt(Above(If(RangeSum(Column(1), -[Daily Sales]) >= [Safety Stock], RangeSum(Column(1), -[Daily Sales]), RangeSum(Column(1), -[Daily Sales], EOQ))), [Opening Stock])

Closing Stock
=If(RangeSum(Column(1), -[Daily Sales]) >= [Safety Stock], RangeSum(Column(1), -[Daily Sales]), RangeSum(Column(1), -[Daily Sales], EOQ))

View solution in original post

2 Replies
sunny_talwar

I think, for third row you should have a closing stock of 90 because your starting is 70 and the daily sales is 10... making is 60 and plus 30 = 90

May be try these expressions

Opening Stock
=Alt(Above(If(RangeSum(Column(1), -[Daily Sales]) >= [Safety Stock], RangeSum(Column(1), -[Daily Sales]), RangeSum(Column(1), -[Daily Sales], EOQ))), [Opening Stock])

Closing Stock
=If(RangeSum(Column(1), -[Daily Sales]) >= [Safety Stock], RangeSum(Column(1), -[Daily Sales]), RangeSum(Column(1), -[Daily Sales], EOQ))
LaalBaadshah
Contributor
Contributor
Author

thank you very much , this worked exactly how I wanted, Also I want to show the average of these closing stock in a KPI would that be possible.