# How to sum a group of sub items?

Hello Memebers,

Thank-you for creating tool like Kobo. It helped easy my survey tool I m building,

I have the following question on Kobo which has sub-items, each item has (Yes,No,N/A) choice. The main question is the group containing all its sub-items.
Then , there is a total score to be calculated using the following assumption/condition:

Hi @DanielEth,

Welcome to the community! At the moment you will need to do the calculations manually under the calculation column by setting some rule. At the moment i see 13 sub items. Is this all that you have that requires a calculation or is there more sub items? Maybe the community could show you how the calculation looks like (if you are OK to learn the notion).

Besides, would you also clarify the following so that the community could come up with a precise solution to your issue:

If an sub item is selected `Yes` does it carry a value of `1`? And do you wish to calculate the total of the score that has been selected?

Have a great day!

Hi @DanielEth,

Sorry for making this query again. But could you please list out all the sub items and then provide the score for the choices e.g.

Occurrence log sheet
Yes (β¦ points)
N/A (β¦ points)
No (β¦ points)

Microscope preventive maintenance form
Yes (β¦ points)
N/A (β¦ points)
No (β¦ points)

and so on β¦

This is because, being clear on what you require the community could provide you with a precise response.

Have a great day!

Hi @DanielEth,

Maybe this is what you were seeking.

#### Reference xlsform:

Sum 2020 08 12.xlsx (12.0 KB)

Have a great day!

Is this possible to do in Kobo ? Assigment like count =count + 1

if((\${Q1_4}=β1β),\${count_y}=\${count_y}+1,if((\${Q1_4}=β2β),\${count_n}=\${count_n}+1,if((\${Q1_4}=β3β),\${count_na}=\${count_na}+1,β0β)))

Hi @DanielEth
I am glad to know that the workaround suggested by @Kal_Lam actually worked on your end.

It is definitely possible to do this but you need to write your formula appropriately. As it is, I am still finding it difficult to figure your logic on this, maybe some more information will help me better support you to get this done.

Stephane

1 Like

Hi
A quick check shows that your form has a different issue

Could you first sort it out by solving the issue based on the discussions that happened here

1 Like

Hi,
Kindly check the topic, this is definately an error on the form and we have experienced it before and solved it within the topic I shared. Kindly have a look at it.

Stephane

1 Like

Hi,
Unfortunately we have to limit the conversations here since this is a very form specific issue and not a system related issue.

I would give an explanation of the logic so that you try it out, you can check all the Yes summation and No summation using an example logic below.

Number of Yeses
((if(\${Q1_2a}=βYesβ,1,0))+(if(\${Q1_2b}=βYesβ,1,0))+(if(\${Q1_2c}=βYesβ,1,0))+(if(\${Q1_2d}=βYesβ,1,0))

Stephane

2 Likes

This the solution i needed with lots of trail and calculation variables. Take a look ?

Done to small part, now its matter of duplication

Cheers! @Kal_Lam @stephanealoo

2 Likes

Hello,
Would you mind to share the solution code here too?

2 Likes