Alteryx Designer Desktop Discussions

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

Select Randomly one person from an address

Bitopi
7 - Meteor

Hi Everyone, 

 

I have few name and address information in my file and multiple persons are present in one address. Will Sample tool help me to select randomly any one person living in a particular address?  

 

Any guidance will be highly appreciated. 

 

Thanks in advance,

8 REPLIES 8
AngelosPachis
16 - Nebula

Hi @Bitopi 

 

I don't think that a simple sample tool can do it because it doesn't have the option to randomly select a single resident per address.

 

You can use a formula tool to assign a random number between 0-1 to each resident and then keep only the resident with the highest number assigned per address. This is dynamic, so every time the workflow runs, new number will be assigned to the residents of each address

 

AngelosPachis_0-1620291825595.png

 

Hope that helps,

 

Angelos

 

Bitopi
7 - Meteor

Thank you for the help

Kurohits
10 - Fireball

Hi @Bitopi 

 

You can easily do that with the help of Random % sample tool. This tool picks up records randomly and displays the output. each time you run the workflow, the result gets changed. 

 

Check my solution. 

 

 

AngelosPachis
16 - Nebula

But I think the requirement here is to randomly get a single person from each group and the Random % Sample tool doesn't have an option to group by.

 

For example if your input is something like this

 

AngelosPachis_0-1620310488342.png

 

you want to get one person from address A and one from address B, and I don't see how the Random % sample tool can do that. Correct me if I'm wrong @Kurohits @Qiu 🤔

apathetichell
18 - Pollux

@AngelosPachiswouldn't batch macro with a random % sample work? If we think of it as 1000 corporate locations versus 1,000,000 residential houses that makes sense - no? then again - poster says "living." and I can't see the macro/random sample approach making sense for that situation.

 

unique set on a address will obviously give the first record in each set. Not quite random though.

AngelosPachis
16 - Nebula

@apathetichell I can see how a batch macro would work, but isn't it an overkill? Besides, It would probably act as a bottleneck slowing the runtime considerably for large volume of records (10000000 rows for example) as each group should be processed separately.

apathetichell
18 - Pollux

@AngelosPachisYes - unless this is a situation where the amount of people living at an address (apartment buildings/dorms/senior centers) make it useful vis-a-vis the number of locations.

 

For a standard solution - I'd suspect a tile, randomized number via formula tool, summarize select the highest (or lowest) random number grouped by location would make the most sense.

 

But I'm also not sure what I even read what the poster is looking for correctly - and this might not be a case of randomization but rather a case of trying to split a cell with a joint address/name field correctly.  If that is the case - data samples would obviously be helpful.

Qiu
20 - Arcturus
20 - Arcturus

@AngelosPachis  @apathetichell  @Kurohits 

Thank you for calling, I guess.

I tried both approach, which both good to me.
To be perfectly honest, the macro is a bit overkill though. 😁

We could judge better if we can come to  know the real business scenario here.

 

0507-Bitopi-1.PNG0507-Bitopi-2.PNG

 

Labels