I need to derive below columns(marked in yellow) based on Reserve Quantity and Transaction Quantity. Records are Sorted based on Transaction Date,