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

Alteryx Designer Desktop Discussions

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

Random Sample Selected with criterias

alkafalhas
7 - Meteor

Hello

 

I am working on with a set of data that contains Date (YYMMDD) from 1990 - 2020. I would like to pick random samples from this population based on these criterias:

1. Population is from Year 2020

2. Population of 1 requires 1 samples

3. Population of 10 requires 5

4. population > 20 requires 15 samples, which samples have to be well distributed from Jan 2020- Dec 2020

5. The sample selected should be in (DDMMYY) format.

 

Below is the example of the dataset:

Date
200807
200807
200807
200807
200814
200818
200825
200903
200923
200923
201005
201005
201006
920626
930313
931201
941006
970620
970910
980807
980807
990111
990510
990617
991231
991231

 

 

Thank you so much for your help in advance.

 

 

 

5 REPLIES 5
afv2688
16 - Nebula
16 - Nebula

Hello @alkafalhas ,

 

Does this work for you?

 

Regards

alkafalhas
7 - Meteor

hi @afv2688 

 

Do you mind to explain how this sampler works?

afv2688
16 - Nebula
16 - Nebula

Hello @alkafalhas ,

 

Given your explanations and what I did understand from them this is what it does:

 

  • Transforms the data into dates
  • filters out those dates which differ the year from 2020
  • given the amount of rows:
    • 1 - 9 gets 1
    • 10 - 19 gets 5
    • 20 - inf gets 15

 

The logic for the sampler is implemented within the action tool in the macro.

 

If you need anything else let me know

 

Regards

alkafalhas
7 - Meteor

Hello @afv2688 

 

Thank you for the explanation. However, do you mind to explain to me the process flow here?

 

alkafalhas_0-1617718044454.png

 

How did you put the characteristic of the amount of rows?

 

Thank you so much for your help.

afv2688
16 - Nebula
16 - Nebula

Hello @alkafalhas ,

 

On the bottom of the action tool you will be able to see the formula itself.

 

What I did select is the second value, where it says "NNumber value=1000", what this does is modify that parameter (1000) based on the conditions of the formula.

 

Regards

Labels
Top Solution Authors