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

Random value distribution of a value x

Hi all,

is there a way in Qlik to distribute a value of for instance 100 over a set of lets say Relationship Manager ?

Input: Value x

Output: Random value distribution of x over a dimension y (e.g. Relationship Manager), whereby the sum of distributed values has to be x

Thanks,

Patric

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe like this for a integer based distribution:

LOAD * INLINE [
SalesManager
Peter
Paul
Mary
]
;

Let vValue = 100;
Let vSalesManagerCount = FieldValueCount('SalesManager');

LOAD Sum(Value),
SalesManager
Group by SalesManager;
LOAD 1 as Value,
FieldValue('SalesManager',Ceil(RAND()*$(vSalesManagerCount))) as SalesManager
AutoGenerate $(vValue)

View solution in original post

3 Replies
Clever_Anjos
Employee
Employee

Use this approach: Recipe for a Histogram

@hic

avinashelite

could you please explain your requirement with the sample data ??

if you want to create random data then you could use the random() function

swuehl
MVP
MVP

Maybe like this for a integer based distribution:

LOAD * INLINE [
SalesManager
Peter
Paul
Mary
]
;

Let vValue = 100;
Let vSalesManagerCount = FieldValueCount('SalesManager');

LOAD Sum(Value),
SalesManager
Group by SalesManager;
LOAD 1 as Value,
FieldValue('SalesManager',Ceil(RAND()*$(vSalesManagerCount))) as SalesManager
AutoGenerate $(vValue)