Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

First In First Out Calculation

wongkenny240
6 - Meteoroid

Hi all,

I have two tables with the following columns

Table A

NameDateDebt

A

2019-12-0110

A

2020-01-0120
A2020-02-010
A2020-03-0110
B2020-03-0110

 

Table B

NameDateRepayment
A2020-02-0110
A2020-03-0110
A2020-04-015
B2020-04-0110

 

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

NameDateRemaining Debt Balance
A2020-01-015
A2020-03-0110

 

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

6 REPLIES 6
atcodedog05
22 - Nova
22 - Nova

Hi @wongkenny240 

 

This is a stock allocation problem.

 

Here is a workflow for the task.

Output:

atcodedog05_0-1606756688477.png

Workflow:

atcodedog05_1-1606756703043.png

 

Hope this helps 🙂 Feel to ask if you have any questions


If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

 

wongkenny240
6 - Meteoroid

The resultant table of the second row should be A instead of B because the debt of B is 0 already.

 

Result Table

NameDateRemaining Debt Balance
A2020-01-015
A2020-03-0110

 

atcodedog05
22 - Nova
22 - Nova

Hi @wongkenny240 

 

Here is a modified workflow for the task.

Output:

atcodedog05_0-1606799545663.png

Workflow:

atcodedog05_1-1606799560944.png

 

Hope this helps 🙂 Feel to ask if you have any questions


If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

atcodedog05
22 - Nova
22 - Nova

Happy to help 🙂 @wongkenny240 

 

Cheers and Happy Analyzing 😀

 

Feel free to reach out if you face any issues 🙂

wongkenny240
6 - Meteoroid

Would like to ask one more question, is it possible to do this with an iterative macro?

atcodedog05
22 - Nova
22 - Nova

Hi @wongkenny240 

 

Yes it would be possible but that would be more hectic.

Labels
Top Solution Authors