I am working on a report that lists items with the qty hand, then it has a running total of the most recent receipts that I want to stop returning records on the receipt that brings the running total to equal or greater than the qty on hand. Open to any suggestions; sample data;
item qty_on_hand receipt_dt Receipt_qty Total_Received
1001 199 5/25/2018 10 10
1001 199 3/26/2018 1000 1010
1002 191830 2/11/2019 60000 60000
1002 191830 12/26/2018 1055 61055
1002 191830 12/14/2018 100000 161055
1002 191830 5/25/2018 778 161833
1002 191830 4/27/2018 30000 191833
1003 600 9/29/2018 1000 1000
So once the running total reaches the current qty on hand it stops returning receipt records.
Thanks Tek-Tips!
item qty_on_hand receipt_dt Receipt_qty Total_Received
1001 199 5/25/2018 10 10
1001 199 3/26/2018 1000 1010
1002 191830 2/11/2019 60000 60000
1002 191830 12/26/2018 1055 61055
1002 191830 12/14/2018 100000 161055
1002 191830 5/25/2018 778 161833
1002 191830 4/27/2018 30000 191833
1003 600 9/29/2018 1000 1000
So once the running total reaches the current qty on hand it stops returning receipt records.
Thanks Tek-Tips!