community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE
SOLVED

Generating a RANDINT that is less than an existing variable - in this case a median value

Atom

Hello all,

 

I am working to build a formula that generates a RANDOM INTEGER > 1 but less than the MEDIAN VALUE OF A VARIABLE (the new value would have a range of 1 to the MEDIAN VALUE which changes depending on the country- all Median values are >1) – any thoughts as to how to write this?

 

Example below:

IF ([D10b_2_Savings_account_s_total_curent_balance__all_savings]>[Median_D10b_2_Savings_account_s_total_curent_balance__all_savings]) THEN

 

RAND (1,[Median_D10b_2_Savings_account_s_total_curent_balance__all_savings])

 

ELSE [D10b_2_Savings_account_s_total_curent_balance__all_savings]

 

ENDIF

 

Alteryx Certified Partner
Alteryx Certified Partner
I would suggest using a summarize tool to calculate the median value and then using an append fields tool to add that value to your data. Now you can use the randint(median) as your formula.

Cheers,
Mark

Sent from my iPhone
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Alteryx
Alteryx

Hello MMM,

 

Please have a look at the workflow I have created for this. RANDINT will enable you to include a maximum field whereas RAND just produces a number between 0 and 1.

 

 

24-04-2017 13-17-10.png

 

 

 

Hope this helps.

 

Nick

 

 

Atom

Many thanks - this worked!

Labels