Advanced calculations

Hi all,

I am trying to make a calculation of 17 questions together, to get a sum score,

I have looked at the very helpful article of Stephane Aloo:

As Stephane describes in his part of ‘work around for caculations’, I would like to create dummy variables first as well, and then make a sumscore for all dummies together.

But the difference for us is that there is not just one response options that needs to be kept, but actually two.
The response options in our case are:

  • PSC 0 never
    - PSC 1 sometimes
    - PSC 2 often
  • PSC 66 Participant did not understand question
  • PSC 88 (If voluntary mentioned) Don’t know
  • PSC 99 (If voluntary mentioned) refused

So in this case we would like to sum up all 1’s and 2’s. So therefore I think we should have a nested ‘if’, like this:

Also for some items we use reverse scoring, so came up with:

But now it is giving an error code, see attached, Skype error message for some of the items (only the one with double digits. So e.g.:

The first ones are not giving an error code in kobo:

How to get this calculation working?
Very curious to hear about this!



Hi all,

solved. I forgot a parenthesis. So it should have been: if(${c_s_psc_4}=2,2,if(${c_s_psc_4}=1,1,0)) instead of if(${c_s_psc_4}=2,2,if${c_s_psc_4}=1,1,0) . So it should work now.




Hi @frederiksteenwch,

Thank you for sharing your solution with the entire community! It should benefit users having similar issues.

FYI, you could also have a look at different if-statement that has been discussed in the forum here.

Have a great day!