Hi, we are trying to add a calculation that uses values from repeat records by pulling each one separately and dividing it by the sum of all.
For instance (inside the repeat):
Specie | Num of individuals |
Specie 1 | 5 |
Specie 2 | 6 |
Specie 3 | 7 |
Total | 18 |
This is a calculation that we would like to perform (outside the repeat):
(5/18*ln(5/18))+ (6/18*ln(6/18))+ (7/18*ln(7/18)).
Is it possible to accomplish with a current version of Survey123?
Thank you
Hi Guy,
Just checking, but the numeric values (5, 6, 7, 18) are based on the values within the repeat, correct?
This is technically doable within Survey123, though the workflow is not intuitive. This can be accomplished by have a question within the repeat that does the calculation
and then have a question that sums the calculation in the parent form.
The issue is that the sum(${repeat_value}) function will base its calculation initially on the value of the currently entered in values (i.e., 5 after the first repeat, 11 after the second, 18 after the third); the user filling in the form will need to page through the repeats after completion to update the calculation and get correct values.