Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
Not applicable

Generate Minus (-) and Positive (+) Numbers


Hi Qlik Community Members,

I have to say, i'm really starting to enjoy myself in this new found world of QlikView Goodness!!

I'm still getting used to a lot of the tools and functions coming from a SAS background there is a lot to learn, especially terminology wise.

my issue:

I need to generate a table from my main table that has a £ value number next to it from as much as -£1200 to £500

is this possible?

I Cant seem to find a RANDBETWEEN function like in excel

thanks

1 Solution

Accepted Solutions
MVP
MVP

Re: Generate Minus (-) and Positive (+) Numbers

RAND() will return a floating point random number between 0 and 1, so just scale the number:

LOAD

     money(round(RAND()*1700,0.01)-1200) AS Amount

Autogenerate 10000;

View solution in original post

7 Replies
MVP
MVP

Re: Generate Minus (-) and Positive (+) Numbers

You mean to say you want to generate these numbers randomly?

MVP
MVP

Re: Generate Minus (-) and Positive (+) Numbers

RAND() will return a floating point random number between 0 and 1, so just scale the number:

LOAD

     money(round(RAND()*1700,0.01)-1200) AS Amount

Autogenerate 10000;

View solution in original post

thornofcrowns
Valued Contributor II

Re: Generate Minus (-) and Positive (+) Numbers

Try: =-1200+(Rand()*1700)

Not applicable

Re: Generate Minus (-) and Positive (+) Numbers

Brilliant answers thank you all.

so on the back of that, whats the logic behind creating random permutations of a letter, Y or N?

again, thanks

Not applicable

Re: Generate Minus (-) and Positive (+) Numbers

This works just brilliant, thank you so much James

MVP
MVP

Re: Generate Minus (-) and Positive (+) Numbers

Maybe

LOAD

     if(RAND() <=0.5,'Y','N') as RandomLetter

autogenerate 10000;

Not applicable

Re: Generate Minus (-) and Positive (+) Numbers

Perfect, thank you again