Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Random Sample for Multiple Groupings

pta58472
5 - Atom

I have an issue I need help with.

 

I have 5 different variables that I need to get a 10% random sample for each grouping of:

Client, Group Name, Segment, Brand or Generic, Network Name 

 

For example :

10% for Client 1, Group 1, Segment 1, Generic, Network 1 

10% for Client 1, Group 1, Segment 1, Brand, Network 1 

10% for Client 1, Group 2, Segment 1, Brand, Network 2 

10% for Client 2, Group 3, Segment 2, Generic, Network 3

etc. - it's a lot of different variables at play, with lots of different groupings possible: multiple clients, thousands of groups, 4 segments, 5+ network names 

 

Is there a way to do this without a batch macro? I have no idea how to use batch macros. 

 

2 REPLIES 2
ChrisTX
16 - Nebula
16 - Nebula

Have you tried the Sample tool?  Select your columns for Client, Group, Segment, Network in the Group By section.

 

Not sure if I'm correctly understanding your group/sample needs.

 

Chris

PhilipMannering
16 - Nebula
16 - Nebula

The sample tool doesn't give you a random 10% sample. But, to save you from the batch macro, you could

1. add a random number in a Formula Tool

2. Sort by random number

3. Do the first 10% in the Sample Tool with those groupby columns checked as suggested by @chris 

Labels
Top Solution Authors