This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
It's the most wonderful time of the year - Santalytics 2020 is here! This year, Santa's workshop needs the help of the Alteryx Community to help get back on track, so head over to the Group Hub for all the info to get started!
My understanding is that you have some data, each record having a population size, and you want to group these into ranges and count how many records fall into each range. If this is correct, you could add a Formula tool with a Switch statement to create a new field, then group based on that and perform a count. The switch would look something like:
SWITCH([pop], "366+", [pop] >=53 AND [pop] <=365, '53-365',
[pop] >=13 AND [pop] <=52, '13-52', [pop] >=5 AND [pop] <=12, '5-12', [pop] >=2 AND [pop] <=4, '2-4', [pop]=1, '1')
I might have not been clear, but it is not that each record has population size, but my entire dataset is the size of that many records. My final output is the random sample of records, but how many records I get would vary. So if I count all my rows and have only 4 records - I want only 2 random records to show up as my final output. If I end up with 300 records, then I want a sample of 13 records, etc. Hope that makes sense now because I am not trying to create a new field that is calculated based on another field.
This counts your records, and then determines the desired number of samples using your table. Passing it to the Batch Macro, with Samples as the control parameter allows you to update the Random Sample Tool