Alteryx Designer Desktop Discussions

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

FIFO Logic - Iterative Macro

Pravesh_G
5 - Atom

I am trying to reconcile 2 input files - (1 is for "buys" and the other one is for "sells"). The idea is for each "buy" to be consumed by one or more "sell", if necessary or vice versa. So if the difference between the buy and the sell is negative (the sell amount is more than the buy amount) then the same "sell" is used by the next "buy" amount.

 

If the difference is positive (the buy amount is more than the sell amount) then the same "buy" is used by the next "sell" amount.

 

I looked at "santa's iterative macro" and looks like the way to go but i keep getting stuck due to the fact that i have 2 inputs. 

 

Below is the screenshot of "sample" Input(s) and desired Output. TIA

 

Alteryx.jpg

 

 

1 REPLY 1
DavidP
17 - Castor
17 - Castor

Hi @Pravesh_G 

 

The FIFO problem is an interesting one and I've built various versions of it in the past.

 

Attached is one for the example you posted. The key is to reduce all the buy and sell amounts to rows with a quantity of 1. 

 

Have a look through the example and let me know if you have any questions.

 

Another way of solving it is to use an iterative macro. I can build one of those for you if you'd like, but I quite like this method.

 

DavidP_0-1610032406895.png

 

Labels