Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
josemaria_cabre
Contributor III
Contributor III

Random with no repeat

Hi ,

I'm trying to build this table, where random numbers (range between 1 and 7) are generated, but they must be unique within same row:

customernum1num2num3
a154
b432
c714
d156
e461
f631

 

I'd like to assign these random numbers to 'customer' dimension of table 'customers'. How do I acchieve that in my script? Any help would be appreciated.

Best regards,
Jose.

Labels (2)
1 Reply
JordyWegman
Partner - Master
Partner - Master

Hi Jose,

How random should it be? Because you can get RowNo() and the sequential number would give an unique number for each row. You can subtract or add numbers to create different numbers. 

Also you can resident load it in descending order and add another RowNo(). 

Another possibility is creating a rand() function, sort on this rand function and add RowNo().

All these possibilities give you unique numbers for each customer.

Jordy

Climber

Work smarter, not harder