Requirement to randomly find either 5% or minimum of 2 inspections from a given period
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