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

Selecting a specific number of samples

Dansav
6 - Meteoroid

Hey there! 

 

I'm new to this so please bare with me.....

 

I have to select records based on a nominated sample size.

 

For example I have to Select 5 patients from Hospital 1, 3 from Hospital 2 and 7 from Hospital 3? 

 

What would be the best way to do this?

 

Any help greatly appreciated.

 

Thanks 

 

Dan 

5 REPLIES 5
Thableaus
17 - Castor
17 - Castor

Hi @Dansav 

 

How does your dataset look like?


You could set a filter tool to do that if you add a Record ID to each Hospital sample, and then filter by RecordID and Hospital (if all your Hospitals are in a single field).

 

Please share a sample of your dataset, so we can advise you the best way to do it (you can fake some data if you want).

 

Cheers,

Dansav
6 - Meteoroid

My data looks like this, I have already identified how many samples need to be taken from each hospital just need to set it up so that a random sample is extracted from each. 

 

Thanks heaps for your help so far!Capture.PNG

TomWelgemoed
12 - Quasar

Hi,

 

Depending on how many hospitals there are, you may prefer to run this through a macro so it automatically adjusts the random sample size for each hospital.

 

Attaching a workflow example - you will need to modify the fields according to your dataset of course.

 

Regards,

Tom

 

Solution 14.jpg

 

 

Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @Dansav,

 

This should do what you're looking to try and achieve.

 

image.png

 

If this solves your issue please mark the answer as correct, if not let me know! I've attached my workflow for you to download if needed.

 

Regards,

Jonathan

Dansav
6 - Meteoroid

Thanks very much for your help! 

 

Greatly appreciated. 

 

Cheers

 


Dan 

Labels