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.

Sampling using variables from a list

Phill
8 - Asteroid

Hello, 

 

I'm trying to work out the best way to produce a random sample form a list of names that may change.

 

Currently I have something similar which takes the full data and then uses filters for each individual so that they are equally sampled. This works as the individuals don't change but I need to do the same thing where the individual names will change but I still need an equal sample from each name.

 

Getting the list of names wouldn't be difficult I'd just filter off that column and unique it then I'd need a way to use that list as the filter for the full data sample.

 

Not sure if I'm explaining this very well but I cant share the workflow so hopefully this makes sense!

 

Thanks, 

 

Phill

 

10 REPLIES 10
DawnDuong
13 - Pulsar
13 - Pulsar

Hi @Phill 

i looks to me that you need to have a batch macro that allows you to run through a shortlisted list.

the sampling is straightforward, you can just set a number for how many sample you need and use the random sample tool.

Dawn 

Emil_Kos
17 - Castor
17 - Castor

Hi @Phill,

 

Not sure if I understood correctly. I have created a workflow that randomly picks 3 names and show 10 first random records for each of the names:

 

Emil_Kos_0-1624611717706.png

 

Phill
8 - Asteroid

Thanks @Emil_Kos and @DawnDuong 

 

I'll try and explain this again so it makes more sense.

 

Essentially I have a data set of work completed called cases, each case will have the name of the user that completed it and users will complete multiple cases. For quality assurance I need to take a sample say 10% of the cases that each of those users completed within the previous month.

 

I have previously created a workflow for this but it involved filtering form the data set each of the users names and then applying a random sample tool per user before union it back together to produce the sample. However, in this instance the list of users will not always stay the same so I need a method of shortlisting (as you mentioned @DawnDuong) these users and then feeding that into a random sample that would apply that random sample to each user. The tricky bit seems to be applying the random sample to each user.

DawnDuong
13 - Pulsar
13 - Pulsar

Hi @Phill 

it makes more sense now.

just one more question: what criteria do you use to shortlist the users?

A) need to sample for all users who are present in the list?

B) randomly select N or N% of the users 

C) You want to manually key to specify the users to shortlist?

 

dawn 

Phill
8 - Asteroid

Hi @DawnDuong 

 

A) need to sample for all users who are present in the list

 

Thanks

apathetichell
19 - Altair

sample % in a a batch macro - feed in the user name as your control input. This allows you to take 10% of each users case load for sampling purposes.

DawnDuong
13 - Pulsar
13 - Pulsar

Hi Phil

If you need to sample all users, you can do the following:

1) build a batch macro that samples N% for 1 user. Basically, the macro comprises of 1) a filter that is updated by a control parameter and 2) The random sample tool. 
2) to use the macro, you use the Unique tool to get the list of all unique users then feed that list into the “inverted question mark” input. Connect your original data to the normal input.

unf I am swamped today otherwise i can do a mock up for you. Hope the above schematics helps to get you moving closer to the desired output.

dawn 

 

apathetichell
19 - Altair

Try this one - batch macro drop down  allows for selection of percentage of records...

Phill
8 - Asteroid

Thanks @apathetichell I'm not sure exsactly how to use this, this looks to have a lot user control input?

Labels