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

Alteryx Designer Desktop Discussions

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

Deep logic - Assign records to resources

AbhijeetChib
8 - Asteroid

Good Day Everyone ! 

 

I have this very specific requirement, I will try to explain from the excel data below. 

 

CountryPrimaryPrimary_Resource
AustriaSAMMani
AustriaSAMMani
AustriaSAMKev
AustriaSAMKev
AustriaSAMMani
AustriaSAMMani
AustriaSAMSid
AustriaSAMSid
AustriaSAMMani
AustriaSAMMani
Russian FederationSidSid
Russian FederationSidSid
Russian FederationSidSAM
Russian FederationSidSAM
AustriaSAMKev
AustriaSAMKev
BangladeshManiSAM
BangladeshManiSAM
SloveniaKevSid
SloveniaKevSid
AustriaSAMSAM
AustriaSAMSAM
BangladeshManiSid
BangladeshManiSid
BangladeshManiMani
BangladeshManiMani
BangladeshManiSid
BangladeshManiSid
BangladeshManiMani
BangladeshManiMani
BangladeshManiSid
BangladeshManiSid
PolandSAMSAM
PolandSAMSAM
USASidSid
USASidSid
USASidMani
USASidMani
USASidKev
USASidKev
SwitzerlandManiSAM
SwitzerlandManiSAM
MexicoKevSid
MexicoKevSid
Russian FederationSidSAM
Russian FederationSidSAM
Russian FederationSidSid
Russian FederationSidSid
SwitzerlandManiSAM
SwitzerlandManiSAM
MexicoKevKev
MexicoKevKev
South AfricaSAMMani
South AfricaSAMMani
MalaysiaSAMSid
MalaysiaSAMSid
USASidMani
USASidMani
USASidSid
USASidSid
IndiaKevMani
IndiaKevMani
USASidKev
USASidKev
USASidMani
USASidMani
USASidKev
USASidKev
ThailandSAMSAM
ThailandSAMSAM
MexicoKevSid
MexicoKevSid
MexicoKevMani
MexicoKevMani
SwitzerlandManiSid
SwitzerlandManiSid
MexicoKevSAM
MexicoKevSAM
USASidSid
USASidSid
Russian FederationSidSAM
Russian FederationSidSAM
USASidSid
USASidSid
GermanySAMMani
GermanySAMMani
USASidSid
USASidSid
SwitzerlandManiMani
SwitzerlandManiMani
TaiwanSAMKev
TaiwanSAMKev
Russian FederationSidMani
Russian FederationSidMani
USASidKev
USASidKev
JapanKevMani
JapanKevMani
JapanKevKev
JapanKevKev
JapanKevSAM
JapanKevSAM
SwitzerlandManiSid
SwitzerlandManiSid
MexicoKevSAM
MexicoKevSAM
PakistanSAMSid
PakistanSAMSid
AustriaSAMMani
AustriaSAMMani
AustriaSAMSid
AustriaSAMSid
AustriaSAMMani
AustriaSAMMani
AustriaSAMKev
AustriaSAMKev
USASidMani
USASidMani
USASidSid
USASidSid
USASidSAM
USASidSAM
USASidKev
USASidKev
USASidMani
USASidMani
USASidSid
USASidSid
USASidSAM
USASidSAM
USASidSid
USASidSid
USASidMani
USASidMani
USASidSid
USASidSid
USASidSAM
USASidSAM
USASidKev
USASidKev
USASidMani
USASidMani
USASidKev
USASidKev
USASidSAM
USASidSAM
GermanySAMKev
GermanySAMKev
GermanySAMMani
GermanySAMMani
IrelandKevSid
IrelandKevSid
USASidMani
USASidMani
CanadaKevKev
CanadaKevKev
USASidSAM
USASidSAM
SwitzerlandManiKev
SwitzerlandManiKev
United KingdomKevMani
United KingdomKevMani
USASidKev
USASidKev
Saudi ArabiaSAMMani
Saudi ArabiaSAMMani
SwitzerlandManiSid
SwitzerlandManiSid
SwitzerlandManiSAM
SwitzerlandManiSAM
IndiaKevSid
IndiaKevSid
SwitzerlandManiMani
SwitzerlandManiMani
IrelandKevSid
IrelandKevSid
USASidMani
USASidMani
SwitzerlandManiKev
SwitzerlandManiKev
SwitzerlandManiSAM
SwitzerlandManiSAM
ChinaSAMSid
ChinaSAMSid
USASidMani
USASidMani
SwitzerlandManiKev
SwitzerlandManiKev
SwitzerlandManiMani
SwitzerlandManiMani
USASidKev
USASidKev
SwitzerlandManiSAM
SwitzerlandManiSAM
ChinaSAMKev
ChinaSAMKev
USASidMani
USASidMani
USASidSid
USASidSid
SwitzerlandManiMani
SwitzerlandManiMani
BelgiumManiKev
BelgiumManiKev
USASidSAM
USASidSAM
USASidKev
USASidKev
United KingdomKevMani
United KingdomKevMani
SwitzerlandManiKev
SwitzerlandManiKev
USASidSAM
USASidSAM
SwitzerlandManiKev
SwitzerlandManiKev
USASidSAM
USASidSAM
SwitzerlandManiKev
SwitzerlandManiKev
USASidSAM
USASidSAM
SwitzerlandManiSid
SwitzerlandManiSid
SwitzerlandManiSAM
SwitzerlandManiSAM
USASidKev
USASidKev
USASidSAM
USASidSAM
ItalyKevKev
ItalyKevKev
USASidSAM
USASidSAM
USASidSid
USASidSid
SwitzerlandManiSAM
SwitzerlandManiSAM
SwitzerlandManiSid
SwitzerlandManiSid
USASidMani
USASidMani
SwitzerlandManiKev
SwitzerlandManiKev
USASidMani
USASidMani
IrelandKevKev
IrelandKevKev
USASidSAM
USASidSAM
ChinaSAMKev
ChinaSAMKev
AustraliaKevSAM
AustraliaKevSAM
AustraliaKevSid
AustraliaKevSid
AustraliaKevSAM
AustraliaKevSAM
AustraliaKevSid
AustraliaKevSid
JapanKevSAM
JapanKevSAM
ChinaSAMSid
ChinaSAMSid
USASidMani
USASidMani
USASidSid
USASidSid
SwitzerlandManiSAM
SwitzerlandManiSAM
SwitzerlandManiKev
SwitzerlandManiKev
AustriaSAMSAM
AustriaSAMSAM
SwitzerlandManiSid
SwitzerlandManiSid
Russian FederationSidMani
Russian FederationSidMani
SwitzerlandManiSid
SwitzerlandManiSid
VietnamSAMMani
VietnamSAMMani
VietnamSAMKev
VietnamSAMKev
VietnamSAMSAM
VietnamSAMSAM
GermanySAMKev
GermanySAMKev
VietnamSAMMani
VietnamSAMMani
VietnamSAMKev
VietnamSAMKev
VietnamSAMSAM
VietnamSAMSAM
VietnamSAMKev
VietnamSAMKev
VietnamSAMSAM
VietnamSAMSAM
VietnamSAMKev
VietnamSAMKev
VietnamSAMSAM
VietnamSAMSAM
VietnamSAMKev
VietnamSAMKev
VietnamSAMSAM
VietnamSAMSAM
VietnamSAMKev
VietnamSAMKev
JapanKevMani
JapanKevMani
SwitzerlandManiKev
USAManiKev
SwitzerlandManiSAM
SwitzerlandManiSAM
United KingdomKevSid
United KingdomKevSid
MalaysiaSAMMani
United KingdomSAMMani
SloveniaKevKev
ItalyKevKev
IndiaKevSAM
IndiaKevSAM
SpainSidSid
USASidSid
FranceSAMMani
FranceSAMMani

 

 

 

Field primary has jobs assigned to resources based on their countries. Field Primary_Resource has all the job distributed equally amongst the resources (SAM, KEV, MANI and SID). The requirement is that total number of jobs needs to be divided by 4(number of resources) and a threshold number needs to be established. In this case its 326/4 = 81(rounded off in this case). So every Primary above the threshold needs to allocated to Primary_Resource maintaining their countries. For example SID has 115 in Primary so 81 of them needs to remain to SID and remaining needs to be allocated to others. All of SID's locations needs to remain with SID till the threshold of 81 and the remaining can be distributed to others. 

Similarly SAM has 85, 81 of them needs to remain with SAM and 4 needs to be distributed. 81 of SAM's countries need to remain with SAM and remaining can be distributed to KEV and MANI

In the same way - Kev has 57, he will need to receive 24 from others but needs to keep his 57 with him. 

 

I hope I am making sense. 

 

 
2 REPLIES 2
gawa
16 - Nebula
16 - Nebula

hi @AbhijeetChib 

Can you try this WF to see if your requirement is met?

As you can see, "Mani" has 83 JOBs while others have 81 JOBs. It should be more or less correct, minor unbalance still remain though.

image.png

AbhijeetChib
8 - Asteroid

thank you @gawa 

Labels