Free Trial

Alteryx Designer Desktop Discussions

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

Random Sampling

Sjov
5 - Atom

Dear Alteryx Community,

 

Kindly asking for your support on below. In the excel file the first column is Company code and in the second column are different document numbers per each invoice. We need to generate a random sample list of invoices for each company code based on the criteria mentioned in below print screen. For example: if ALTS company code has 10 or less than 10 invoices in the file, than the sample need to generate 2 randomly selected invoices. The other criteria are in the print screen. How can we create a WF in Alteryx to generate this random sample list?

Sjov_0-1713523434026.png

Thank you in advance.

4 REPLIES 4
aatalai
14 - Magnetar

@Sjov this should help, nb each time you run the workflow it will produce the same sample; let me know if you don't want that to be the case

 

Let me know how you get on

ChrisTX
16 - Nebula
16 - Nebula

The attached workflow should point you in the right direction.  It uses the function RandInt to generate a random number, then sorts by the random number.  So the sample will be different each time.

 

Screenshot 2024-04-19 090517.png

 

Chris

Sjov
5 - Atom

Hello Aatalai, 

 

This is too complicated for me, because I am in the beginning :) I could not connect my file with the macro. But thank you very much, I can learn a lot from this workflow. Thank you!

Sjov
5 - Atom

Hello ChrisTX

 

This solution works perfect, thank you very much!

Labels
Top Solution Authors