Hi all,
I have two tables with the following columns
Table A
| Name | Date | Debt |
A | 2019-12-01 | 10 |
A | 2020-01-01 | 20 |
| A | 2020-02-01 | 0 |
| A | 2020-03-01 | 10 |
| B | 2020-03-01 | 10 |
Table B
| Name | Date | Repayment |
| A | 2020-02-01 | 10 |
| A | 2020-03-01 | 10 |
| A | 2020-04-01 | 5 |
| B | 2020-04-01 | 10 |
I want to use a First in First Out approach to get the remaining debt balance and corresponding date of each debt. For example, for the above, I will get the below
Result Table
| Name | Date | Remaining Debt Balance |
| A | 2020-01-01 | 5 |
| A | 2020-03-01 | 10 |
The first debt of A at 2019-12-01 is repaid by repayment at 2020-02-01 (10-10=0), the second debt at 2020-01-01 is partially paid by repayment at 2020-03-01 and 2020-04-01 (20-10-5=5), the third debt at 2020-03-01 is never repaid yet. The first debt of B at 2020-03-01 is repay at 2020-04-01 (10-10=0)
How to perform calculation similar to above in Alteryx?
Thanks a lot.
Thanks,
Kenny