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

Random Value Selection Via a Button

Hi

I'm trying to create a button in Qlik Sense that allows a user to select a random value from a list of possible values depending on the values available after filters have been applied. I've seen a few suggested solutions on here via the reload script but needs to be via a button

In the example below, I'd want to filter sales by date in the normal way, which would give me  a list of all Part Numbers sold during that period and then select a Part Number at random via a button.

Something like Rand(GetPossibleValues(PartNumber)) or Rand(Concat([PartNumber],','))

(appreciate these aren't right but just to give an idea of what I'm trying to achieve)

I'm hoping that I could get the button to set the above value as a variable and then display in a KPI object

Is this possible?

Thanks 

Gavin 

Labels (2)
1 Reply
marcus_sommer

You may try something in this way:

subfield(concat(distinct PartNumber, '|'), '|', ceil(rand() * count(distinct PartNumber)))

- Marcus