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?


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


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]




Hard to give concrete advice without a sample of the data. 


But I would use a summarize tool to produce the medians and then join tool to join back to the original data by country


You can then use the value in a Rand function as you have for each row.


 Happy to help further but would be useful if you could fake some data for us to advise on.