# Calculation not working on KoboCollect, working on Enketo

Hi experts,

I´m reaching out because i´m having trouble to develop a form for a househould survey in which the enumerator will be inteviewing only the head of household asking for information on ethnicity, protection, etc. for all the members.

After each set of questions, I added a calculation and a note showing an error if the information reported was different than the number of household members. I also added a note to see the calculation performed, because I kept getting the errors with every number I entered. I finded out the calculation was working on Enketo, but not on KoboCollect, where there was a blank after a the instruction

Ex- with 2 household members meeting one contition:
Calculation:
\${total}!=\${condition}

On Enketo
2!=2

no error

On Kobo Collect
2!=

error message (if TRUE, then flow blocked)

This will happen with several similar questions I have on the form, making impossible to go through.

Any thoughts or ideas why this might be happening?

Welcome to the community, @giselle_nova! Would you mind sharing with the community the section of your xlsform that holds this issue? Maybe the community too could have a closer look at it.

Hi @giselle_nova
I have been looking at your calculations after the group and they seem to be in order. An example is mujeres_total which looks ok.

Could you kindly point me to the non functional calculation, it will help.

Stephane

1 Like

The problem started on the etnia_miembros group and the calculation of n_etnia_total.

I managed to solve this and other issues on the form by removing the relevants for the variables inside the group, that I believe were causing the sum to fail, showing me that blank after the =

This is not my ideal solution but it is currently working, hope this helps others facing the same problems.

1 Like

@giselle_nova, thank you for sharing your solution with the entire community! This should definitely help users having similar issues.

Hi @giselle_nova
You don’t need to remove the relevant for those groups. Instead you should use coalesce in the sum function. E.g. if you had two question A and B to sum, you use the formula
coalesce(\${A},0) + coalesce(\${B},0)

What this does is that, for every instance where you skipped a question, coalesce replaces that instant with a 0 prior to summation. In essence this will correct for your form quite easily.

Stephane

2 Likes