We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

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!

4 REPLIES 4
Raj
16 - Nebula

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

 

 

 

isabella201
5 - Atom

Interesting challenge! You might try a weighted random selection process where each product's odds are used to calculate a win chance per customer, and then iterate through the list while tracking inventory limits. It’s kind of like asking When Is The Next Powerball Drawing? you need controlled randomness with fixed constraints. Alteryx can handle this, but you'll likely need some combination of batch macros and multi-row formulas to manage inventory depletion.

Labels
Top Solution Authors