KoboToolBox Calculation feature

Hello!

I am trying to find the average of more than one question, and i figured out the equation and everything worked fine. Until, i did skip logic. because of the skip logic some of the questions did not appear and neither their number so the equation is not summing. and the total is not appearing as a number it appears as a NaN. is there a way to fix this?

thank you! if this is not clear please tell me and i will try to make it clearer as much as possible


this is an example i did and it works, however, if i dont fill in number of pets for example due to skip logic, the result will be NaN.

The problem you are seeing is that you are using unanswered (ie blank) values in a calculation; these blank values are, alas, not treated as zero! Hence, as soon as you get a NaN (literally, ‘Not a Number’) in your calculation, the whole calculation result becomes NaN…

Have a read of this which explains the issue and how to solve it: Form Logic - ODK Docs

Basically, you just need to stick a few coalesce() functions in your sum calculation.

1 Like

@janjan, this post discussed previously should also give you a clue of what @Xiphware is trying to explain.

In addition, you should also be able to find more discussions on the coalesce function here.

thank you @Xiphware and @Kal_Lam for your help! i followed your instructions and it worked well!! thanks again

1 Like