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: 
Linus42
Contributor II
Contributor II

Random Sample

I have a table in Qlikview containing customer data and their status. I want to add a button to pick 3 random customers in the table for the manager to do a manual control. Preferably I would like to have 3 random customers in the 3 different statuses available. What would be the best approach? 

Labels (1)
1 Reply
Qrishna
Master
Master


Hi - 

In the load script, add RecNo() as field:

LOAD *,
RecNo() as Rec;
LOAD CustomerID,
CustomerName,
[Case ID],
Status,
[Sales Date],
[Sales person]
FROM
[C:\Users\Krrish\Desktop\Comm\sampledata.xlsx]
(ooxml, embedded labels, table is Sheet1);

you can create three variables in the button: 
vSetRand1 = ceil(Rand()*0.1*now()/1000)
vSetRand2 = ceil(Rand()*0.15*now()/1000)
vSetRand3 = ceil(Rand()*0.2*now()/1000)

Add Action to the button:
'Select in field' = Rec
Value = ='(' & $(vSetRand1) & '|' & $(vSetRand2) & '|' & $(vSetRand3) & ')'

 

Snip.PNG

PSA

 

PSA