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?
Solved! Go to Solution.
Hi @aparna0208,
You may use a rand function to randomly sort your data. Afterwards, you can just use the sample tool.
@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?
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.
Makes sense. Thank you for the explanation 🙂 @Emil_Kos
@aparna0208 Happy to help 😀