I have a dataset with buildings in column A and employees that work in those building in column B. Each person in column B can work in multiple building in column A. I need to ship a package to each individual building, however in order to do that I need to first select an employee in the building. The catch is, each employee can only be used 1 time. I need to find a way in alteryx to ultimately give me each individual building, and only 1 employee from it, and the employee can not be the one that was selected for another building. I am aware that this may not be possible for all, I just need as many as possible, and can manually adjust the remaining that did not have the correct people.
Example Data Below:
Building | Employee |
A | 1 |
A | 3 |
B | 5 |
B | 1 |
B | 2 |
C | 7 |
D | 9 |
E | 2 |
E | 3 |
E | 1 |
F | 4 |
F | 6 |
F | 3 |
F | 8 |
G | 9 |
G | 5 |
H | 5 |
I | 3 |
I | 1 |
Obviously this isn't your real data, but .... .for Building H, the only employee there is #5. For Building D, the only employee there is #9. For Building G, the only employees there are #9 & #5. The problem is that if you set H-5 and D-9, there are no options for G
If this were your real data, is it expected to have more employees (who can receive mail) at each building?
The true data contains thousands of building and thousands of employees. There will be some buildings that are not able to be shipped to because there is not an available employee since the employee may be being used for a different office. This is fine, as I need as many as possible and will deal with those without a viable employee later.
Hi @pbresney ,
Please let me know if the attached workflow works.
The idea is use Iterative Macro which follows the steps below:
Step 1. Pick the 1st line of the table and output the [Building]-[Employee] pair.
Step 2. Filter out the [Building] and the [Employee] from the rest of the table.
Step 3. Input the output of Step 2 as the next Iteration.
Workflow
Iterative Macro
Input
Building | Employee |
A | 1 |
A | 3 |
B | 5 |
B | 1 |
B | 2 |
C | 7 |
D | 9 |
E | 2 |
E | 3 |
E | 1 |
F | 4 |
F | 6 |
F | 3 |
F | 8 |
G | 9 |
G | 5 |
H | 5 |
I | 3 |
I | 1 |
Output
Building | Employee |
A | 1 |
B | 2 |
C | 7 |
D | 9 |
E | 3 |
F | 4 |
G | 5 |