ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Random sampling using multiple fields

chandran0107
5 - Atom

I am looking to random sample using multiple fields.

 

for example: I need 30% of sample using Approved by but the output should have equal proportions of Assignee. I tried using the sample tool but was not able to achieve the desired result. 

 

ID AssigneeApproved by
   
1HemaManager1
2ChanManager1
3AbdulManager1
4KiaraManager2
5ChanManager2
6KiaraManager2
7KiaraManager1
8ChanManager1
9AbdulManager1
10KiaraManager1
11AbdulManager3
12KiaraManager3
13ChanManager1
14KiaraManager1

 

Output should be similar to what I have below. It has 30% sample of approved and also makes sure that it captured all assignees

 

1HemaManager1
2ChanManager1
4KiaraManager2
11AbdulManager3
14KiaraManager1

 

5 REPLIES 5
Qiu
21 - Polaris
21 - Polaris

@chandran0107 
I thought we can just simply apply Random % Sample for each Assignee, but there is an issue here if there is only one record for a certain assignee.

This is as per documentation in the Sample workflow so if one record, then 1 x 0.3 = 0.3, then the nearest integer would be 0.
Maybe I am overdoing it, but create a bit logic to include the one record situation.

This option will randomly select N% of the rows to be output (or the whole number closest to N%, if N% is not an integer).

 1221-chandran0107A.png1221-chandran0107B.png

chandran0107
5 - Atom

@Qiu,

 

Thanks for your response. I tried to apply your logic to my parent workflow, and I got an error in the control parameter saying it needs to be mapped.

Do you know what could be the reason? 

 

chandran0107_1-1765840295863.png

 

Qiu
21 - Polaris
21 - Polaris

@chandran0107 
Please check my flow, you need to connect your data to the reversed "?" anchor.

chandran0107
5 - Atom

Yes, I did the same. My data input is an excel file both in the macro and parent workflow. I have it connected to the reversed "?" anchor. Please let me know if I am missing something. I have attached screenshots below for reference. Thank you for the help!

 

chandran0107_0-1765905958128.png

 

chandran0107_1-1765906044299.png

 

Qiu
21 - Polaris
21 - Polaris

@chandran0107 
If you have mentioned me, I could notice your reply earlier.

Maybe this one?

2025-12-18 120246.png

Labels
Top Solution Authors