Alteryx Designer Desktop Discussions

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

Loop Through Record or Multirow Formula

Shank
8 - Asteroid

Hi All, 

 

Good day!

 

I am stuck with a task where i need to allocate the quantity in batches to order can someone help me on this. Below is the scenario.

 

From table 2 I need to allocate the quantity in batches to order. for example. batch ZMR1 is having 450 units and it can full fill order 1, 2, 3 and 50 units of order 4. but for order 4 we have requirement of 150 units (50 units is consumed from ZMR1 and Rest 100 units should be taken from batch ZMR2. Can someone help on this i tried using multirow? but I was not able to achieve desired output. 

 

Table 1: 

Order NoProductunits
1A100
2A200
3A100
4A150
5A120
6A130
7A110
8A145
9A180
10A170

 

Table 2

ProductBatchQuantity
AZMR1450
AZMR2210
AZMR3150

 

Desired Output

Order NoProductQuantityBatchOpening BalanceUnits consumedClosing Balance
1A100ZMR1450-100350
2A200ZMR1350-200150
3A100ZMR1150-10050
4A150ZMR150-150-100
4A150ZMR2210-100110
5A120ZMR2110-120-10
5A120ZMR3150-10140
6A130ZMR3140-13010
7A110ZMR310-110-100

 

7 REPLIES 7
caltang
17 - Castor
17 - Castor

Hi @Shank,

 

I am able to combine the tables into the first portion of your desired output: 

 

Order NoProductQuantityBatch
1A100ZMR1
2A200ZMR1
3A100ZMR1
4A150ZMR1
4A150ZMR2
5A120ZMR2
5A120ZMR3
6A130ZMR3
7A110ZMR3

 

However, in order to calculate Opening Balance, Units consumed, and Closing Balance, is something that I am stuck at myself. 

 

Hopefully my workflow gives you some ideas on how to proceed from there. I'll continue trying to achieve your output, but the difficulty is because of the existence of the Order No and two or more batches it belongs to. The relationship becomes one to many, and that affects your formulas by row.

 

 

Best,

Cal

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Christina_H
14 - Magnetar

Here's a macro that I think does what you need.

Christina_H_0-1675251338497.png

 

Shank
8 - Asteroid

@Christina_H 

 

Good day!

 

Many thanks for helping me on this one.

 

This works perfectly fine for one scenario. But I have multiple order and multiple product how can we fix it?   below is the example.

 

I tried to change something in macro, but it did not work well :( 

 

Table 1: 

Order NoProductunits
1A100
2A200
3A100
4A150
5A120
6B130
7B110
8C145
9C180
10C170

 

Table 2

ProductBatchQuantity
AZMR1450
AZMR2210
AZMR3150
BZBR150
BZBR2150
CZCR1150
CZCR2150
Shank
8 - Asteroid

Hi @caltang

 

Thanks for taking a time to help me on this problem :) 

 

Even, I achieved the same as what you did but by combining the two tables, but I was stuck after that on getting the closing balance as we had Mutiple batches. 

 

Yes, please let me know if you get any solution. also, I will keep you posted I get the desired result :) 

Christina_H
14 - Magnetar

Hi @Shank

 

I've made some changes to the macro to work with multiple products.  I think it's doing what you need now.

Raj
14 - Magnetar

@Christina_H  thanks for sharing I was also looking for something similar

Shank
8 - Asteroid

@Christina_H 

 

Thanks for the sharing the workaround. It perfectly works. 

Labels