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

Randomized Sample Selection

agimpel
7 - Meteor

Hello! 

 

I have a population that has three different types of tests - Test of Design, Control test 1 and control test 2. Each of the three tests is associated with different controls, see below example:

ControlTest
ATest of Design
AControl Testing 1
AControl Testing 2

 

for my total population consisting of hundreds of controls - i want to select random samples but have the breakout be 30% test of design, 30% control testing 1 and 30% control testing 2. how would i do this in Alteryx?

 

thanks! 

8 REPLIES 8
OTrieger
12 - Quasar

@agimpel 
There is a tool Random % Sample you can use this tool. If you will divided the different test types and set the tool for 30% from each you will get that result.

agimpel
7 - Meteor

what do you mean by divide the different test types? in the random % sample it just has the Random N% of records. Additionally, I do not want to duplicate selection from within each control. for example, if I select the test of design from control A I do not also want to select the Control Test 1 or 2 from that control. How would I do this to additionally ensure that I'm selecting one type of control test for each control? 

OTrieger
12 - Quasar

So, you will need to do it in the following way:
Get a 30% sample from Test design, then use a join tool to get the controls that were not selected yet. Take these items and run it for Test 1 with 43%, and the use again a join tool to get the remaining controls and run it on Test 2 with 75% now you will get 30% from each of the different tests ensuring that you will not have the same controls

agimpel
7 - Meteor

I'm still confused on how you would do this within the tools. could you please provide an example of how you would do this? not sure how you would get the 30% sample from the test of design etc. 

ChrisTX
16 - Nebula
16 - Nebula

Can you post a larger sample input file, possibly in Excel format?

 

 

agimpel
7 - Meteor

I have attached an example! basically want 30% of each type of test but do not want to repeat within the same control (example not picking test 1 if test of design is already selected for control A for example) 

ChrisTX
16 - Nebula
16 - Nebula

See attached workflow.

 

Using brute force.   Would be more eloquent using a macro.  Maybe a batch macro that calls an iterative macro.  But hey, hope it works.

 

Screenshot 2024-09-11 155223.png

 

Chris

agimpel
7 - Meteor

thanks so much!!!

Labels