Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
puttemans
Specialist
Specialist

Assign random number

Hi all,

I have a table of around 750.000 lines, in which around 20 products are comprised over these lines. My issue is that the table is ordered on the product type, and so product 1 will be stting in the first lines, and product 20 in the last lines (I don't easily know how many lines each product has).

My wish is to assign a random number (from 1 to 750.000) to each line in the table, so that when I order the table on the random number, all products are mixed. I've looked at Autonumber and Rand, but those don't seem to be helpful.

Is there any other solution possible?

Thanks

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try ceil(Rand()*750000))


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
MK_QSL
MVP
MVP

RowNo() as ID is not working for you..

Or you are looking for something different?

Can you provide little 5-6 line sample with your required output?

Gysbert_Wassenaar

Try ceil(Rand()*750000))


talk is cheap, supply exceeds demand
puttemans
Specialist
Specialist
Author

Thank you, this does the job perfectly. With the function, I now get an average that has only a spread between the different products of around 35.000, whereas it used to be 12.100.000 with the ordered table. So this is certainly an improvement. (average calculated over either the line ID = rowno and the solution above)