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

Requirement to randomly find either 5% or minimum of 2 inspections from a given period

Hi Folks,

I've been playing around with a requirement to find a script to identify a sample of 5% of the inspections that have been carried out in the last month for each area.  If the sample is smaller than 2 inspections then 2 is the minimum to be returned.

I've managed to get the 5% returned using Sample 0.05 before the load, but it is the minimum of 2 inspection that is causing me the biggest challenge.

I can produce a frontend calculation to generate the numbers using the following 

Floor((Aggr(Count({<[Assessment MonthName]={'$(=MonthName(Today(1),-1))'}>} distinct [siteReportID]),[Area])*0.05)+2)

but using this in the script obviously doesn't work  even when I try using Group By.

All suggestions greatly received

Stay Safe

Labels (1)
  • SaaS

0 Replies