Hi Ksharp, I am trying to implement the same logic and found out your algorithm working. But in addition to FIFO logic for calculating balance I also need to calculate aging of dates. For example: Date ID Credit Debit 01Mar2018 123 100000 50000 05Mar2018 123 50000 0 15Mar2018 123 0 50000 20Mar2018 123 0 0 21Mar2018 123 0 50000 Would have aging calculated as 15thMarch - 1March = 14 days for first Credit. Step 1:(100000-50000 = 50000) Step 2:(50000 - 0 = 50000) Step 3:(50000 - 50000 = 0) = Aging for 1stmarch credit = 15thMarch - 1March = 14 I tried by altering your algorithm and fetching end dates was possible using criteria (Where x[i]=0). But I am not getting a hold of how do I get start date.
... View more