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: 
alec1982
Specialist II
Specialist II

Create Random Column with 15 to 25 %

Need to create a column from a sales amount column to show randomly 15 to 25% for a sales column. Anyone has a quick logic

1 Solution

Accepted Solutions
sunny_talwar

My bad, it should have been this:

((Rand() * (0.25 - 0.15)) + 0.15) * Sales as Rand_Sales

View solution in original post

6 Replies
sunny_talwar

May be like this:

((Rand() * (0.25 - 0.15)) + 0.25) * Sales as Rand_Sales

Clever_Anjos
Employee
Employee

Maybe this?

Transactions:

Load

  Rand1

Where Rand1 >= 0.15 and Rand1 <= 0.25;

Load

Rand() as Rand1

Autogenerate 100000;

alec1982
Specialist II
Specialist II
Author

this returns more than 25%  of the sales amount.

Thanks,

Badr

alec1982
Specialist II
Specialist II
Author

my table has two columns

Transaction ID and Sales Amount

I need to add additional column for profit and it is random values of 15 to 25 % of sales amount

sunny_talwar

My bad, it should have been this:

((Rand() * (0.25 - 0.15)) + 0.15) * Sales as Rand_Sales

Clever_Anjos
Employee
Employee

Transactions:

Load

[Transaction ID]

, Rand1 as [Sales Amount]

Where Rand1 >= 0.15 and Rand1 <= 0.25;

Load

Rand() as Rand1,

recno() as [Transaction ID]

Autogenerate 100000;