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

Macro for Random Sampling

Niks_diageo
7 - Meteor

Hello Friends,

 

As i am new to Alteryx, can you please help me to create macro on below requirement:

 

I need random sampling script which pulls the sampling matrix (function & level) from (criteria sheet) and give me random sampling from (dump sheet).

 

attaching sample test data for your reference.

 

thanks in advance.

 

Regards,

Nikhil

2 REPLIES 2
danilang
19 - Altair
19 - Altair

Hi @Niks_diageo 

 

Batch Macros for the win!

 

MainMain

 

 

The main workflow transposes the criteria so that you get a Row for each Function, Level and Quantity, and feeds these into the control input of the macro.  The data is fed into the data input

 

Macro.png 

 

The macro filters the data based Function and Supply and the Random Sample tool takes a random sample of the filtered records.  This macro loops over all the rows in the control input and applies the filter and number of samples from each row and unions the results of all the iterations in the output

 

The results look like this

 

Results.png

 

Dan

Niks_diageo
7 - Meteor

Thanks @danilang . your solution worked.

 

Regards,

Nikhil

Labels