Select to view content in your preferred language

Formula for calculating totals for metric questions within a group - when number of groups are variable

112
2
Jump to solution
2 weeks ago
SusanWS_nysm
Occasional Contributor

Good morning,

I suspect that what I wish to do exceeds Survey123 capabilities - but I would love to be proven wrong ;-).

Here is my problem:

I have a rather complicated Survey123 survey that I am developing in Survey123 Connect for an assessment of assets. I have 4 "metric-type" questions that answer questions based on a scale of 0 to 3 ( 0 = n/a, 3 is the worst) and the field is numeric. my last question needs to be a formula that calculates a total score that adds up all the numbers from these 4 questions. I have a formula that I know works for calculating the total of the numeric values recorded by the 4 survey questions. However, the questions are within a group -- and the number of groups can vary from survey to survey (I am recording the "health" of assets in a storage container -- each survey represents a container, and each group represents an object within the container).

 

Any advice would be greatly appreciated.

Happy New Year!

Susan

@Ismael 

 

0 Kudos
1 Solution

Accepted Solutions
ZacharySutherby
Esri Regular Contributor

Hello @SusanWS_nysm

To confirm when you reference "group" do you mean a repeat? Those 4 questions are within a repeat and the number of repeats can vary per survey? 

If that's the case you can create 4 hidden questions outside of the repeat that use the sum() function to calculate the sum for each of the questions within the repeat. So sum(${repeat_question_1}), sum(${repeat_question_2}, etc. then you can those 4 questions together in a separate calculate question just using the plus operator. 

Thank you,
Zach

View solution in original post

2 Replies
ZacharySutherby
Esri Regular Contributor

Hello @SusanWS_nysm

To confirm when you reference "group" do you mean a repeat? Those 4 questions are within a repeat and the number of repeats can vary per survey? 

If that's the case you can create 4 hidden questions outside of the repeat that use the sum() function to calculate the sum for each of the questions within the repeat. So sum(${repeat_question_1}), sum(${repeat_question_2}, etc. then you can those 4 questions together in a separate calculate question just using the plus operator. 

Thank you,
Zach
SusanWS_nysm
Occasional Contributor

Dear Zach,

Thank you very much! Yes, I do mean  repeats (it seems I was using XLS Forms terminology rather than the term Survey123 Connect employs 😉). 

And with your guidance, I found this blog article that details repeats as well as aggregation methods using hidden questions -- again, much appreciation for your reply!

 

0 Kudos