Alteryx Designer Desktop Discussions

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

Sample from categories

AlterixNoob
7 - Meteor

Hi Guys - 

 

I have a large population of data (around 400K lines). The population is broken down into certain categories (for e.g. Category A, Category B etc.) and i want to select 1 sample from each category.

 

Can someone advise how i can do this in alteryx?

 

Thanks

 

 

6 REPLIES 6
Maskell_Rascal
13 - Pulsar

Hi @AlterixNoob 

 

This can be accomplished using the Sample Tool. You can select a group by option that will allow you to select a sampling for each group based on how you configure the tool.

 

Here is more information on the sample tool: https://help.alteryx.com/current/designer/sample-tool

 

If this solves your issue please mark the answer as correct, if not let me know!

 

Thanks!

Phil

 

 

javiwood
6 - Meteoroid

How is your data coming in?

 

What do you have so far?

 

Without knowing what you have so far, I will wing it. If it is one connection, I would use a filter to filter out the category and then use the sample tool to pass through only 1 row.

AlterixNoob
7 - Meteor

Thanks, Yes it's just one connection. I could do a filter but that would mean having 15-20 filters as i have 15-20 categories so looking for a better solution

AlterixNoob
7 - Meteor

Can the sample tool select a random sample? I don't want it to select the first one from each category. I don't want to define which record to pick, i just want it to pick one record at random from each of the categories

afv2688
16 - Nebula
16 - Nebula

Hello @AlterixNoob ,

 

how about this solution:

 

Untitled.png

 

This macro takes all the categories and depending on your selection takes the amount of random lines that you select on the macro.

 

If you need anything else let me know!

 

Regards

Maskell_Rascal
13 - Pulsar

Hi @AlterixNoob 

 

Try this method:

Maskell_Rascal_0-1617980522545.png

 

You create a random field, sort by company and newly created field, and then use the Sample Tool to select the first record of each group. 

 

Thanks!

Phil

 

Labels