Hello,

I have a survey for a number of measurements, in total 32. The measurements compose a matrix of 4 by 8 (4 different heights, 8 different wind directions). Not all points must be measured, it is up to the field guy which measurements he/she takes.

All possible measurement points are represented by an integer question in my survey. For various reasons I am not using repeats.

Now, I want to make some calculations like max(), min(), sum(), avg(), but only for those measurement points that do have a value.

Does anyone have a tip how I can tackle this task (efficiently) in Survey123?

Thank you very much, best regards,

Jürgen

Hi Jürgen,

There are a couple of ways to do this:

- if you have a few calculations, you can use the coalesce() function to provide an alternative value if a question is not answered (null) - coalesce(${q1}, 0) will return the value in q1 when present, 0 otherwise

- an alternate formula to coalesce would be: if(string-length(${q1}) = 0, 0, ${q1})

- If you have a large number of calculations, you can add a calculate question after each measurement to store the coalesce or if/string-length function (likely making the bind:esri:fieldType null to not add fields to the table) and use the calculate questions' values instead.