Free Trial

Alteryx Designer Desktop Discussions

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

Populate lines based on an other table's values

karolyb
5 - Atom

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)

LocationProductYear-QuarterCapacity
BUDMatches2024-Q11
BUDMatches2024-Q23
BUDMatches2024-Q32
BUDMatches2024-Q44
BUDMatches2025-Q14
BUDMatches2025-Q22
BUDNapkins2024-Q12
BUDNapkins2024-Q23
BUDNapkins2024-Q31
BUDNapkins2024-Q41
BUDNapkins2025-Q11
BUDNapkins2025-Q21

 

Table #2example (there are multiple locations and products in the real example)

LocationProduct
BUDMatches
BUDMatches
BUDMatches
BUDMatches
BUDMatches
BUDMatches
BUDMatches
BUDMatches
BUDMatches
BUDMatches
BUDMatches
BUDMatches
BUDMatches
BUDMatches
BUDMatches
BUDMatches
BUDMatches

 

 

Desired Result:

LocationProductYear-Quarter
BUDMatches2024-Q1
BUDMatches2024-Q2
BUDMatches2024-Q2
BUDMatches2024-Q2
BUDMatches2024-Q3
BUDMatches2024-Q3
BUDMatches2024-Q4
BUDMatches2024-Q4
BUDMatches2024-Q4
BUDMatches2024-Q4
BUDMatches2025-Q1
BUDMatches2025-Q1
BUDMatches2025-Q1
BUDMatches2025-Q1
BUDMatches2025-Q2
BUDMatches2025-Q2
BUDMatchesUnallocated

 

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!

1 REPLY 1
OllieClarke
15 - Aurora
15 - Aurora

Hey @karolyb 

no need for iterative macros here - you can use the generate rows tool to do this:

 

image.png

Labels
Top Solution Authors