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 | Assignee | Approved by |
| 1 | Hema | Manager1 |
| 2 | Chan | Manager1 |
| 3 | Abdul | Manager1 |
| 4 | Kiara | Manager2 |
| 5 | Chan | Manager2 |
| 6 | Kiara | Manager2 |
| 7 | Kiara | Manager1 |
| 8 | Chan | Manager1 |
| 9 | Abdul | Manager1 |
| 10 | Kiara | Manager1 |
| 11 | Abdul | Manager3 |
| 12 | Kiara | Manager3 |
| 13 | Chan | Manager1 |
| 14 | Kiara | Manager1 |
Output should be similar to what I have below. It has 30% sample of approved and also makes sure that it captured all assignees
| 1 | Hema | Manager1 |
| 2 | Chan | Manager1 |
| 4 | Kiara | Manager2 |
| 11 | Abdul | Manager3 |
| 14 | Kiara | Manager1 |
@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).
@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
Please check my flow, you need to connect your data to the reversed "?" anchor.
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!