Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Is this a use case for batch or iterative macro?

tearless75
6 - Meteoroid

I have two datasets. 

(a) table

GroupNumber
A2
B3

 

and

(b) table

GroupFactor
A4
A12
A100
A4200
A5100
A6200
B1
B4
B13
B190
B30000
B889199995

 

What I need to do is

For each group in the table (a), I have to multiply with the numbers from the top in the same group in the table (b)

Please see below

 

GroupFactor  
A44*2=8=> it becomes the new number of Group A in the table (a)
A128*12=96=> the new number 8 from the previous calculation is compared with 12. If this new number is bigger than 12, then it stops. However if the number is smaller (which is the case in this situation), the new number 8 is being multiplied by 12. Then, this 96 becomes a new number of the group A in the table a
A10096*100 = 9600=> Now 96 is compared with 100 and since it is smaller, I multiply 96 by 100
A4200 => Now 9600 is bigger than 4200. It stops here and 9600 becomes the final number of the group A in the table a
A5100  
A6200  
B1 The same process starts with 3 since this is the B group number in the table a. This process will stop after multiplying 3000 and the final B group number in the table a will be 889200000
B4  
B13  
B190  
B30000  
B889199995  

 

Not sure if I'm explaining the logic well. It seems pretty complicated case for me and not sure whether I should use macros or multi-row formula to solve this problem. 

In real situation, I would have thousand of numbers in the table a...

 

Any advice and solution will be greatly appreciated!!!

3 REPLIES 3
jdminton
12 - Quasar

I think you can get away with a multi-row formula to do this. Use a find replace to add the multiplier that starts and then a multirow to take the first row times the multiplier and then all of the other rows times the previous row. Share the workflow if you are having issues after that.

aatalai
14 - Magnetar

@tearless75  I agree with @jdminton re find and replace and multi-row tool. I've mocked up a workflow to help you. Let me know how you get on.

tearless75
6 - Meteoroid

@jdminton and @aatalai Thank you so much. I was able to solve the problem using multi-row formula. 

Labels