Hi there,
I'm having an issue figuring out a logic for the following Alteryx Problem.
I have two tables:
Table one contains 'capacity' data by year-quarter by 'location' and 'product' type.
Table two contains line items for each 'location' and 'product' each line represents a quantity of 1
Taks to solve: Allocate Year- quarter data to 'Table #2' to as many lines, as many capacity there for a given quarter in table #1.
Table #1 example (there are multiple locations and products in the real example)
Location | Product | Year-Quarter | Capacity |
BUD | Matches | 2024-Q1 | 1 |
BUD | Matches | 2024-Q2 | 3 |
BUD | Matches | 2024-Q3 | 2 |
BUD | Matches | 2024-Q4 | 4 |
BUD | Matches | 2025-Q1 | 4 |
BUD | Matches | 2025-Q2 | 2 |
BUD | Napkins | 2024-Q1 | 2 |
BUD | Napkins | 2024-Q2 | 3 |
BUD | Napkins | 2024-Q3 | 1 |
BUD | Napkins | 2024-Q4 | 1 |
BUD | Napkins | 2025-Q1 | 1 |
BUD | Napkins | 2025-Q2 | 1 |
Table #2example (there are multiple locations and products in the real example)
Location | Product |
BUD | Matches |
BUD | Matches |
BUD | Matches |
BUD | Matches |
BUD | Matches |
BUD | Matches |
BUD | Matches |
BUD | Matches |
BUD | Matches |
BUD | Matches |
BUD | Matches |
BUD | Matches |
BUD | Matches |
BUD | Matches |
BUD | Matches |
BUD | Matches |
BUD | Matches |
Desired Result:
Location | Product | Year-Quarter |
BUD | Matches | 2024-Q1 |
BUD | Matches | 2024-Q2 |
BUD | Matches | 2024-Q2 |
BUD | Matches | 2024-Q2 |
BUD | Matches | 2024-Q3 |
BUD | Matches | 2024-Q3 |
BUD | Matches | 2024-Q4 |
BUD | Matches | 2024-Q4 |
BUD | Matches | 2024-Q4 |
BUD | Matches | 2024-Q4 |
BUD | Matches | 2025-Q1 |
BUD | Matches | 2025-Q1 |
BUD | Matches | 2025-Q1 |
BUD | Matches | 2025-Q1 |
BUD | Matches | 2025-Q2 |
BUD | Matches | 2025-Q2 |
BUD | Matches | Unallocated |
My approach was to use an iterative macro inside a batch macro - batching read the inputs from table #2 an iterate through every single item in table #1 (sample the 1st row and everything else but the 1st row (that's the returning branch during the iterations).
My issue with this approach was I was not able to see if there very any remaining unallocated items from the list (eg.: if the total capacity for each 'location' and 'product' is < the total rows in the list for the same 'location' and 'product' is in table #2)
How would you approach this problem? I'm not necessarily looking for a solution for the issue, rather I would like ideas on how others would approach it.
Thank you!
Solved! Go to Solution.