# Calculate a sum from inside a repeat group

integer Aayes Aa_yes. How many members tested COVID positive? yes
begin_repeat HS Health Status \${Aayes} field-list
note note_HS Ab. What is the current health status of these members?
integer text_Ab1 1. Currently home Quarantine NOS yes \${text_Ab1}>=0 minimal
integer text_Ab2 A. Recovered NOs yes \${text_Ab2}>=0 minimal
integer text_Ab3 3. In hospital NOS yes \${text_Ab3}>=0 minimal
integer text_Ab4 4. Died NOS yes \${text_Ab4}>=0 minimal
end_repeat
calculate sum \${text_Ab1} + \${text_Ab2} + \${text_Ab3} + \${text_Ab4}
note value_all_four Note: Value must be equal to members tested COVID positive \${sum}. Please go back and re-enter. \${sum}=\${Aayes} yes

@dipendra, could you be specific and try sharing your issue with an xlsform to be easy for us to add any if required?

@dipendra, could you please share with us the xlsform? It would be much easier with the same.

Could you share with the community the xlsform?

OK, so what is your issue? Please try to explain in detail. Maybe you could also extract the portion of the xlsform that has issues so that the community could directly focus on the same.

Survey2021.xlsx (23.2 KB)

we want to calculate the value of [Aayes} is must be equal to sum of all [Ab1 ,Ab2 ,Ab3 Ab4 ]

OK, you could do it as outlined in the post discussed previously:

i try but not able to do … if possible please add in my script

@dipendra, I see that you however do not need to sum the total household members from within the roster as you have used `repeat_count` which should iterate your household members until it exactly matches the total members recorded. If you still wish to you could use the `if-statement` as shared in the post discussed previously.