Fetch record

Fetch record

    Hi guys,
I need fetch record that match the criteria of total of request submitted for day are < 100 and alert that which is the first day with less than 100 request submitted. 
How can I set a complex criteria that collect Day = input.Day < 100 and then return first day available? I try some count function and expression without success.
Any suggestion?
Thanks

Mike

dayavalaible  =  Form  [ID != 0] sort by  Day  range from 1 to 1;
dayavalaible1 = dayavalaible.Day;

alert("First day avalaible" + dayavalaible + "");