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

Alteryx Designer Desktop Discussions

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

Batch macro needed?

eaphymao
7 - Meteor

I have a problem where I have multiple DC's to fill inventory to multiple stores. My input data looks like the below.

 

Input 1

DC Style Inv
1Apple10
2Apple5
3Apple3
4Apple2
5Apple10


Input 2

StoreStyleNeed
1Apple7
2Apple6
3Apple4
4Apple3
5Apple1

 

and I want to get an output detailing the complete list of inventory from which DC to which stores. Something like the below. 

DCStoreFill
117
123
223
232
332
341
442
551

 

I can use a multi-row formula to solve the problem when I have a single DC, but after I exhaust the single DC how would I get Alteryx to use the next DC on my list to fulfill the remaining demand until all the demand is met? 

 

Output for a single DC using a multi-row formula

StoreStyleNeedDCInvFillRemaining InvRemaining Need
1Apple7110730
2Apple613300
3Apple410004
4Apple310003
5Apple110001

 

I think I would need a batch macro, but how would I get it to consider the remaining need after using inventory from a previous DC? Am I even on the right track?

5 REPLIES 5
LordNeilLord
15 - Aurora

Hey @eaphymao

 

There is a weekly challenge that tries to solve this problem. There are many varied approaches that people took but have a look through some of the solutions provided and see if any give you a better direction. 

 

https://community.alteryx.com/t5/Weekly-Challenge/Challenge-14-Warehouse-Distribution/m-p/36743

 

@LordNeilLord

Part time Tableau, Part Time Alteryx. Full Time Awesome


Data Lover

eaphymao
7 - Meteor

Hey @LordNeilLord,

 

That's similar, but not quite far enough.

 

I'm able to solve the weekly challenge as is, however I have more than one central DC. I have multiple DC's. So i'm trying to figure out how I can have Alteryx automatically move onto the next DC and apply the allocation logic to fill remaining store demand after i've already used up the inventory in the first DC. 

 

Any help would be appreciated. Thank you!

BenMoss
ACE Emeritus
ACE Emeritus

Looks like you'll need an iterative macro which will allow you to remove stock allocation as you fill it.

 

Let me take a detailed look.

Ben

BenMoss
ACE Emeritus
ACE Emeritus

See attached a solution. It may not be perfect but should be close!

 

Ben

eaphymao
7 - Meteor

Thank you so much! That's exactly what I was looking for. It really helps me understand how the macro works

Labels
Top Solution Authors