# Sum / count multiple choice

il y a 6 ans 3 mois #82095 par ljanka
ljanka a créé le sujet : Sum / count multiple choice
I have a problem, I tell it with the example:

Q1 is a multiple choice question, with subQ 1,2,3....

I want to only ask Q2 (multiple choice, array filter: Q1) from people who checked minimum 2 answer. (so if you checked only 1 in Q1, jump the queston).

I tried the following:
Relevance equation:
sum(Q1_1,Q1_2,Q1_3,...,Q1_n)>1

But it doesn"t want to work.
And I have Version 1.92+ Build 120608, the newest.
Anyone can help me?

Thanks a lot!

Connexion ou Créer un compte pour participer à la conversation.

il y a 6 ans 3 mois #82100 par tpartner
tpartner a répondu au sujet : Sum / count multiple choice
Try:
`sum((Q1_1 == 'Y'), (Q1_2 == 'Y'), (Q1_3 == 'Y'),...(Q1_n == 'Y')) > 1`

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Connexion ou Créer un compte pour participer à la conversation.

il y a 6 ans 3 mois #82103 par TMSWhite
TMSWhite a répondu au sujet : Sum / count multiple choice
Another option is:
`count(Q1_1, Q1_2, Q1_3, ..., Q1_n) > 1`

Connexion ou Créer un compte pour participer à la conversation.

il y a 6 ans 3 mois #82123 par ljanka
ljanka a répondu au sujet : Sum / count multiple choice
I tried it in my survey, but it didn't want to work
But, your formulas are good, I tested it in a small "test" survey wth only 2 questions. Both formulas worked well, as I need it.

So I really don't understand, why it doesn't work in my real survey. In that survey the question has 26 subquestions (anwer options). Could it be the problem, the too many subquestions?

Connexion ou Créer un compte pour participer à la conversation.

il y a 6 ans 3 mois #82124 par Mazi
Mazi a répondu au sujet : Sum / count multiple choice
Too many options shouldn't be the problem.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Connexion ou Créer un compte pour participer à la conversation.

il y a 6 ans 3 mois #82188 par ljanka
ljanka a répondu au sujet : Sum / count multiple choice
I attached the survey (I copied into a new one, the questions).

There are some array filter. Do they can modify the validation?

I tried these validation equations:

count(Q17_1, Q17_2, Q17_3, Q17_4, Q17_5, Q17_6, Q17_7, Q17_8, Q17_9, Q17_10, Q17_11, Q17_12, Q17_13, Q17_14, Q17_15, Q17_16, Q17_17, Q17_18, Q17_19, Q17_20, Q17_21, Q17_22, Q17_23, Q17_24, Q17_25, Q17_26) > 1

sum((Q17_1 == 'Y'), (Q17_2 == 'Y'), (Q17_3 == 'Y'), (Q17_4 == 'Y'), (Q17_5 == 'Y'), (Q17_6 == 'Y'), (Q17_7 == 'Y'), (Q17_8 == 'Y'), (Q17_9 == 'Y'), (Q17_10 == 'Y'), (Q17_11 == 'Y'), (Q17_12 == 'Y'), (Q17_13 == 'Y'), (Q17_14 == 'Y'), (Q17_15 == 'Y'), (Q17_16 == 'Y'), (Q17_17 == 'Y'), (Q17_18 == 'Y'), (Q17_19 == 'Y'), (Q17_20 == 'Y'), (Q17_21 == 'Y'), (Q17_22 == 'Y'), (Q17_23 == 'Y'), (Q17_24 == 'Y'), (Q17_25 == 'Y'), (Q17_26 == 'Y')) > 1

And I really don't understand why it doesn't work, because I tested it another small survey and both method were excellent...

Could you help me?
##### Pièces jointes :

Connexion ou Créer un compte pour participer à la conversation.

il y a 6 ans 3 mois #82192 par ljanka
ljanka a répondu au sujet : Sum / count multiple choice
OMG
After clicking a lot in limesurvey, I found my problem what I didn't recognize before, I used ' symbol, and the right one is, the double ".....

So thanks for your help !!!

Connexion ou Créer un compte pour participer à la conversation.

il y a 6 ans 3 mois #82200 par TMSWhite
TMSWhite a répondu au sujet : Sum / count multiple choice
Since you are using Array Filter, you need to use the following equation:
`count(Q17_1.NAOK, Q17_2.NAOK, Q17_3.NAOK, Q17_4.NAOK, Q17_5.NAOK, Q17_6.NAOK, Q17_7.NAOK, Q17_8.NAOK, Q17_9.NAOK, Q17_10.NAOK, Q17_11.NAOK, Q17_12.NAOK, Q17_13.NAOK, Q17_14.NAOK, Q17_15.NAOK, Q17_16.NAOK, Q17_17.NAOK, Q17_18.NAOK, Q17_19.NAOK, Q17_20.NAOK, Q17_21.NAOK, Q17_22.NAOK, Q17_23.NAOK, Q17_24.NAOK, Q17_25.NAOK, Q17_26.NAOK) > 1`

The .NAOK suffix is only needed in equations where one or more variables might be irrelevant (e.g. not shown due to conditions and/or array filtering). In general, if any variables are irrelevant, the entire equation is irrelevant. To over-ride that behavior, use the .NAOK suffix.

Examples and documentation of .NAOK can be found here and here .

Connexion ou Créer un compte pour participer à la conversation.

il y a 6 ans 3 mois #82264 par Mazi
Mazi a répondu au sujet : Sum / count multiple choice

ljanka écrit: OMG
After clicking a lot in limesurvey, I found my problem what I didn't recognize before, I used ' symbol, and the right one is, the double ".....

Tom, does it really make a difference if you use ((q1=="2")) or ((q2=='2'))? Can't one use both kind of quotes?

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Connexion ou Créer un compte pour participer à la conversation.

il y a 6 ans 3 mois #82275 par TMSWhite
TMSWhite a répondu au sujet : Sum / count multiple choice
Mazi-

You should be able to mix the types of quotes. The root issue is that this was a case where the .NAOK suffix was needed.

So, I'm not sure what that OMG comment meant.

Connexion ou Créer un compte pour participer à la conversation.

il y a 6 ans 3 mois - il y a 6 ans 3 mois #82283 par Mazi
Mazi a répondu au sujet : Sum / count multiple choice
Thanks for clarifying, Tom!

Is there any reason why one shouldn't always use ".NAOK" for all expressions?

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"
Dernière édition: il y a 6 ans 3 mois par Mazi.

Connexion ou Créer un compte pour participer à la conversation.

il y a 6 ans 2 mois #83005 par TMSWhite
TMSWhite a répondu au sujet : Sum / count multiple choice

TMSWhite écrit: Since you are using Array Filter, you need to use the following equation:

`count(Q17_1.NAOK, Q17_2.NAOK, Q17_3.NAOK, Q17_4.NAOK, Q17_5.NAOK, Q17_6.NAOK, Q17_7.NAOK, Q17_8.NAOK, Q17_9.NAOK, Q17_10.NAOK, Q17_11.NAOK, Q17_12.NAOK, Q17_13.NAOK, Q17_14.NAOK, Q17_15.NAOK, Q17_16.NAOK, Q17_17.NAOK, Q17_18.NAOK, Q17_19.NAOK, Q17_20.NAOK, Q17_21.NAOK, Q17_22.NAOK, Q17_23.NAOK, Q17_24.NAOK, Q17_25.NAOK, Q17_26.NAOK) > 1`

There is also a shortcut so that you don't have to write such long equations. You can use the following:
`count(self.NAOK) > 1`

or (to refer to Q17 from a different question, such as to only display Q18 if at least two questions from Q17 were answered):
`count(that.Q17.NAOK) > 1`

Both of these will be auto-expanded to the longer equation shown. Documentation about this feature is found here .

Connexion ou Créer un compte pour participer à la conversation.