Quantcast
Channel: Data Preparation & Blending discussions
Viewing all articles
Browse latest Browse all 4999

Iterative macro to assign salespeople a desired number of contacts

$
0
0

Hi everybody

I opened  another topic a couple of days ago, but then "someone" changed his opinion and I'm adding more complexity...

 

As a recap I have a list of 500 000 accounts and 200 salespeople. The salespeople are working from different cities here in Italy (28 cities) and we need to divide the accounts between the different salespeople, based on cities.

So I already created a little workflow where I joined the 2 files: the one with the accounts and the other with each italian city and the city where it should be assigned.

 

So for example I have the accounts living in the city of Milan that should be assigned to people of Milan's office, but as Milan will get also the accounts from cities immediately around, like Pavia, now I have my joined file with the columns

Account ID | city     | city where it will be managed|

aaa1000     |Milan   | Milan

aaa1001     |Pavia   | Milan

aaa1002     |Rome  | Rome

 

The first problem is that each office has a ifferent number of salespeople, so in Rome they are 10, in Milan they are 20 and so on

 

@RodL suggested me to use a macro batch, so I started to try to understand how they work (I'm new to Alteryx), but now I get new instructions from the management...

 

The new request is that each salesperson must have a total of 2608 account, so, if salesperson A already has  1200 accounts, he needs to get 1408 new accounts, while if salesperson B has 300 accounts he will get 2308 accounts.

 

So now I have this list of salespeople with name, city and the number of accounts he/she needs to get

 

I read something about the iterative macros, so I thought that they could be of some use, but I'm wondering if I understood correctly their objective.

 

My thinking is: I have the two lists, so now I need to

  1. check how many accounts salesperson A has to get
  2. check how many accounts salesperson A already has gotten (so I need to add to the file with the accounts a new column with the names of the salesperson that now has that account)
  3. if the number of his accounts is the same that is stored in my file, so he got 1408 new accounts (plus the 1200 he already had), then I can go on with Salesperson B
  4. check if there are any accounts not assigned with the city of the salesperson A
  5. assign an account to salesperson A
  6. restart the iteration

 

Is that something possible?

 

Or should I go with a batch macro and the tiling, trying to update the manual tiling value each time for each salesperson? (assigining before to each account a value of 1 and inserting the total amount of accounts a salesperson should get as the manual cutoff)

 

Sorry for the long post (that sometimes seems more a "thinking aloud" post than a request), and thanks for any help

Giovanni

 

 

 


Viewing all articles
Browse latest Browse all 4999

Trending Articles