Free Trial

Alteryx Designer Desktop Discussions

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

Sample tool

aparna0208
8 - Asteroid

Hi,

 

Looking for some help with sample tool. I have a dataset as seen in the attachment where each employee will be mapped to different ids and will have 50 to 100 rows. I need an output where 10 rows are randomly picked for each employee. I tried using the sample tool and selected 1in N chance to include each row for sample type(N=10) and grouped employee. When I do this I get less or more than 10 rows for each employee. But what I want is exactly 10 rows for each employee. Is this something possible with sample tool?

 

 

5 REPLIES 5
Emil_Kos
17 - Castor
17 - Castor

Hi @aparna0208,

 

You may use a rand function to randomly sort your data. Afterwards, you can just use the sample tool. 

 

 

Emil_Kos_0-1628713620197.png

 

aparna0208
8 - Asteroid

@Emil_Kos Thank you so much for your inputs. This worked. Could you please provide some context on rand() function. What is does in this case?

Emil_Kos
17 - Castor
17 - Castor

Hi @aparna0208,

 

The expression rand() generates a number between 0 - 1. At least that is what I have found on the internet 😀

 

We are generating random numbers and afterwards, when we sort the data we will have values in random order. Thanks to that on each run we will get a new 10 random records for each person. I hope that makes sense. 

aparna0208
8 - Asteroid

Makes sense. Thank you for the explanation 🙂 @Emil_Kos 

Emil_Kos
17 - Castor
17 - Castor

@aparna0208 Happy to help 😀

Labels
Top Solution Authors