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.

I want to pick random row from row

Sshasnk
8 - Asteroid

have to pick a random from each fund

Input: 

Fundamountprior year amount
ABC123145
ABC145156
LMN145615
LMN15923
XYZ45656
XYZ2314
ABC15645
XYZ45656
XYZ2314

 

Example: 

1. ABC Fund is three if you count So I have to pick a number from 1 to 3 and whichever number comes I have to pick that row value

2. In short one random value from each fund

 

Fundamountprior year amountRandom
ABC123145 
ABC145156X
ABC15645 
LMN145615X
LMN15923 
XYZ45656 
XYZ2314X
XYZ45656 
XYZ2314 
3 REPLIES 3
gautiergodard
13 - Pulsar

Hey @Sshasnk 

Here is one way you could do this:

gautiergodard_0-1670426794754.png

 

The rand() formula will generate a random value every run, so you can sort on it and use a sample tool after to select a value.

 

Hope this helps.

ShankerV
17 - Castor

Hi @Sshasnk 

 

Use the sample tool, where you select the Group by Column as Fund.

 

ShankerV_0-1670427368832.png

 

Many thanks

Shanker V

 

DavidSkaife
13 - Pulsar

@ShankerV @Sshasnk 

 

The Sample tool will not work in this scenario, as N is not consistant across the funds. i.e ABC has 3 instances, LMN has 2, and XYZ has 4.

 

Plus the Group by option isn't applicable for 1 in N chance:

 

DavidSkaife_0-1670428286718.png

 

Labels
Top Solution Authors