Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
talita_verdes
Partner - Contributor III
Partner - Contributor III

Random value

Good afternoon!


I am not sure how to make a random value in a field.



For example:


If the field A = 2 then random between 1 and 10, if field A = 3 then random between 40 and 60.



I used it, but it did not work:



- Interval

- IntervalMach

- Rand


What can I do?


Thanks

1 Solution

Accepted Solutions
sunny_talwar

May be like this

If(A = 2, Rand() * (10-1) + 1, If(A = 3, Rand() * (60-40) + 40))  as RandNum

View solution in original post

2 Replies
vishsaggi
Champion III
Champion III

Quite did not get that. Can you explain a little with some sample data and expected output you are looking for?

sunny_talwar

May be like this

If(A = 2, Rand() * (10-1) + 1, If(A = 3, Rand() * (60-40) + 40))  as RandNum