Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Filter out one random unique row ID

skwan
5 - Atom

Hello,

 

I have data structured as follows:

 

Record #IDCol1Col2Col3
11000abc
22000def
32000ghi
43000jkl
54000mno

 

What I want to do is randomly select an ID with equal probability then output a table with every row with that ID. So I used Unique on column ID to pull out records with unique IDs (records 1,2,4,5. Then Random % Sample (with Random N=1 Records) to pull out one of these rows. If I randomly selected ID 1000, 3000, or 4000 my job is done. But how do I ensure I get back Records #2 and #3 if I randomly selected ID 2000? Is there a way to finish my approach or is there a simpler way?

 

Thanks

3 REPLIES 3
cplewis90
13 - Pulsar
13 - Pulsar

Hey @skwan,

 

Based on what I am gathering from the info provided, you could do the random sample to get that value and then join it back onto the original dataset to get all occurrences of that ID.

 

This should work even if the ID only shows up once.

 

Let me know if this works.

 

 

skwan
5 - Atom

Okay that makes sense. The join tool normally adds additional columns for the join but I would be unchecking the boxes in the tool configuration for all the right table elements?

 

Thanks I think that should work.

cplewis90
13 - Pulsar
13 - Pulsar

To answer your question would depend on what is in each one, but yes you would remove any unwanted output fields.

 

Excellent! If it doesn't let me know and I can think through what else could be done.

Labels