Alteryx Designer Desktop Discussions

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

Select Lottery Winners based on Set of Odds

bchen1
6 - Meteoroid

Hello - I have a randomization/lottery problem that I need some help with. I have 2 datasets (sample data attached):

  • A List of customers
  • A List of products, available inventory and odds of winning each product (expressed as a %)

My desired output is the same list of customers with an additional column that notes which product they won (if any). A few constraints / notes:

  • Not every customer needs to win something
  • Once inventory is exhausted for that product, customers can no longer win it (i.e. if product A has 10 available, only 10 customers can win it at most)
  • Not all inventory needs to be used

I've been trying to figure out the right way to run this in Alteryx but not sure on what the right way to approach/start is. Would appreciate any help here. Thank you!

3 REPLIES 3
Raj
14 - Magnetar

HI,

you can try something like this using this logic if this suffice your requirement 

 

FrederikE
13 - Pulsar

Hey, 

I'd go with something like this. 

 

kboeckholt
7 - Meteor

Here's my solution. A couple of assumptions I made 1) Customers can win more than one prize and 2) Inventory is handed out in order of Entry No.

 

kboeckholt_0-1677218174129.png

Input with Odds:

kboeckholt_1-1677217504795.png

Formula:

kboeckholt_2-1677217542975.png

Output:

kboeckholt_4-1677217644135.png

 

 

 

Labels