Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

pivot table to derive sampling methodology

kavivkc
6 - Meteoroid

Hi, I need recommendation to use correct tool to derive "15% of the population or 10, whichever is greater If the population is less than 10 then 100%" as a outcome(samples) of each population in the pivot table 

 

 

4 REPLIES 4
BrandonB
Alteryx
Alteryx

You could use a count records tool and append the resulting value to the data set. Then you could run it through filters for each branch of corresponding logic and union afterwards: 

 

BrandonB_0-1632778427896.png

 

kavivkc
6 - Meteoroid

The workflow doesn't work as I need formula to derive 15% of the population or 10, whichever is greater If the population is less than 10 then 100%" from the population column.

BrandonB
Alteryx
Alteryx

The workflow does work - you were asking for the best tool to establish routing based on record count and I specified that the count records being appended to each row allows you to subsequently run it through a filter with separate branches of logic followed by a union tool. 

 

BrandonB_0-1632785820004.png

 

 

To take this a step further, you would add a filter tool where count >= 67 because 15% of 67 is 10.05 so any population under 67 would result in 15% being smaller than 10. The top flow where record counts are greater than or equal to 67 go through a random % sample of 15% of records. Everything going through the false being less than 67 records goes through the same random sample tool, but configured to take a random 10 records. Anything less than 10 records going through the bottom part of the stream would result in the population size being sampled. 

kavivkc
6 - Meteoroid

The sampling methodology is as "15% of the population or 10, whichever is greater If the population is less than 10 then 100%"

 

So I have population is 100, the sample size should be 15% of population or 100& sample if population is less/equal to 10.

 

Please guide the formula.

Labels