Free Trial

Alteryx Designer Desktop Discussions

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

Random selection of records

cseputis
5 - Atom

Hi,

I am trying to obtain a random selection of 25 IDs and their corresponding records from a dataset.  .

For reference, within my dataset, I have thousands of ID numbers, wherein each ID will appear multiple times given they have multiple records associated with the ID.  I'd like to use one of the random sample tools within my workflow to select 25 of the IDs and return all of the records associated with the 25 IDs selected randomly.


I am very new to using Alteryx Designer, but I also may be overthinking this.  Nonetheless, I can't seem to figure it out.  Any knowledge or insight on how to accomplish will be greatly appreciated.

 

Thanks!

6 REPLIES 6
IraWatt
17 - Castor
17 - Castor

Hey @cseputis,

Do you have an example dataset for context?

Thanks,

Ira

ChrisTX
16 - Nebula
16 - Nebula

Here's one way to do it

 

ChrisTX_0-1661181219364.png

 

 

Chris

cseputis
5 - Atom

Hi Ira,

Certainly a ton more IDs in my dataset, but here is a screenshot that may help.

 

cseputis_0-1661185821666.png

 


Thanks,

Chuck

 

cseputis
5 - Atom

Hi,

Just following up on my last reply for additional context.  If IDs 02, 04, and 06 were among the randomly selected 25 IDs, the highlighted items would all be within the set of results.

cseputis_0-1661186199149.png

 

 

Thanks again,

Chuck

cseputis
5 - Atom

I figured this out.  From my original dataset, created a separate flow using the Select, Unique, and Random % Sample tools, focusing on the ID to produce the random sample of 25 IDs.  Then I used a Join at the end of my overall workflow to get the results I'm after.

ChrisTX
16 - Nebula
16 - Nebula

Nice solution.  The workflow I posted is almost the same.  I used a Formula tool to create a random number field, then sorted on the random number, then used a Sample tool to select the first 25.

 

Chris

Labels
Top Solution Authors