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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikwiz123
Creator III
Creator III

Show random rows in a table every time

I created a data table. How do I show 50 random rows from a field in the table? Every time user refreshes the data, the table should show only 50 randomly selected values from that field. 

Labels (2)
4 Replies
Bhushan_Mahajan
Creator II
Creator II

@qlikwiz123 You can debug it with 50 as a row limit

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Do you want to do this in script or a chart?

-Rob

qlikwiz123
Creator III
Creator III
Author

Hi, either way works for me. Doing at chart level might slow down the chart load but I would like to try both and see which one performs better 🙂

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

For script, you can do something like:

Sample:
LOAD
  Value as Sample
Resident Data
Where Rand() > 0.8
and RowNo() <= 50;

You can play with the Rand() limit but the RowNo() will limit you to 50 rows. 

For chart, I'm not sure how you can limit to 50, but you could get a set of random values as:

Aggr(if (Rand() > 0.8, Value), Value)

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com