Count below a number in a repeat group

Hello everyone,

I’m trying to develop a form that shows in a repeat group how many responses below 16 and below 15. Readings are sugar in fruit so can be as much as I can take from a sample.

My intention is to get the % of values from the total universe of readings.<16 and <15.
The repeat_group name is “sugars”

I’m using count({sugars}) to get the n° of repetitions so I can get the % but I’m very struggled with the formula to get the n° of readings <16 and <15.

I have tried something like count({sugars})<16 but is not working.
I have also tried relevance, constrain without any sucess.

I would be very greatfull if anyone knows how to solve this issue.

Thanks in advance!

Hi @Nachinho,

Welcome back to the community! Would you mind having a look at the discussion that has been discussed earlier. It should solve your issue:

You could also have a look to this post:

Have a great day!


It worked prefectly!

I have used in calculation:

if(${brix} < 16, 1, 0 )

and then:


I need to review what does it mean ,1,0 to understand that sentence properly.

Thank you very much!


1 Like

Hi @Nachinho,

It’s an If condition similar to the one you use in Excel. Here, when using if(expression, then, else), returns then if expression evaluates to True. Otherwise, returns else.

Simplifying it further, ${brix}<16 is your expression where you are trying to provide a value 1 if the variable ${brix} is less than 16. If and in case, this condition does not satisfy, it will select a value 0.

Would you mind having a look at the support article Advanced Use of Calculate Questions. It should provide you with more examples on how to use the advanced calculations in KoBoToolbox.

Have a great day!

1 Like

Many thanks @Kal_Lam, a very clear explanation. Also your shared link is quite useful.



1 Like