Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Random % selection of data sample

Question for the group on best approach and is it possible? If so how?

I have an app, with data loaded in memory.

I want the end user to be able to randomly select a % sample of the data without reloading it based upon a slider.

i.e If The app has 1000 records loaded into memory and the user decides they want a random sample of 30% of the data within the graphs, listboxes etc, they move the slider to 30% and the app selects the random 30% from memory.

Clicking back/clear resets the records to the full 1000 ...

Possible?

(I have the ability to do this on load , thanks to help from Gysbert and using Sample (n) already)

Robin.

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

Use trigger on a variable linked to a slider. Se attached example.

This is only working if you clear the account field before you use the slider.

Didn't get it to clear the field in the trigger... weird.

Cheers

View solution in original post

5 Replies
Not applicable
Author

Further details (since Robin is helping me with this)

Using this article we were able to define a random sample within the app by manually entering an expression into the listbox:

QlikView Maven: Random Sample Selection

For example, =rand()<=0.2+now()*0

Rather than have to enter this each time, we'd like to have a slider that the user could adjust and have the random sample criteria be applied.  Example data is attached.

Thanks!

Ravi

Not applicable
Author

Hi,

Use trigger on a variable linked to a slider. Se attached example.

This is only working if you clear the account field before you use the slider.

Didn't get it to clear the field in the trigger... weird.

Cheers

Not applicable
Author

Thanks Martin.

Not applicable
Author

Splendid, thanks Martin!

Not applicable
Author

Apparently there isn't an OnClear trigger but a commonly suggested workaround is to add the trigger OnAnySelect and count the current selections.  If this is zero then the Clear button has been pressed.  I used this to set the variable behind the slider to 100%, see attached