# Calculate not working because one data used for calculating irrelevant

Hello,

I'm having a hard time with a calculate issue.

One of the data used in the calculation is relevant only if it is answered yes to the previous question. If I answer "NO", the question doesn't appear in the survey. But then the calculation always indicates "0" as a result (whereas it is an addition).

Here are the details =

The calculate is

Calculate/ H27 = \${H11} * \${H13} + \${H20} * \${H21} + \${H24} * \${H25}

H20 is relevant if H19 = yes
H24 is relevant if H23 = yes

After, I add another calculate named

Calculate/ H28 = sum(\${H27})

(note that it works because the H27 row is in a repeat)

So the calculate seems to be working, only when H20 and H24 are both relevant. Otherwise, the sum(\${H27}) always indicates 0.

Thanks a lot for you help! You'll find attached the doc if it can help.

Cheers,

Charles

Quantitative_survey_extract.xlsx (27.2 KB)

Hi Charles,

If you can reduce this form to a few questions that show the problem,
I'm glad to take a look and see where the problem might be.

Yaw

ยทยทยท -- Need ODK consultants? Nafundi provides form design, server setup, in-field training, and software development for ODK. Go to https://nafundi.com to get started.

On Sat, Aug 20, 2016 at 4:39 PM, c.teffo@gmail.com wrote:

Hello,

I'm having a hard time with a calculate issue.

One of the data used in the calculation is relevant only if it is answered yes to the previous question. If I answer "NO", the question doesn't appear in the survey. But then the calculation always indicates "0" as a result (whereas it is an addition).

Here are the details =

The calculate is

Calculate/ H27 = \${H11} * \${H13} + \${H20} * \${H21} + \${H24} * \${H25}

H20 is relevant if H19 = yes
H24 is relevant if H23 = yes

After, I add another calculate named

Calculate/ H28 = sum(\${H27})

(note that it works because the H27 row is in a repeat)

So the calculate seems to be working, only when H20 and H24 are both relevant. Otherwise, the sum(\${H27}) always indicates 0.

Thanks a lot for you help! You'll find attached the doc if it can help.

Cheers,

Charles

## --

You received this message because you are subscribed to the Google Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.