Sum / count multiple choice

More
7 years 2 months ago #82095 by ljanka
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!

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
7 years 2 months ago #82100 by tpartner
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.
Official LimeSurvey Partner - partnersurveys.com

Please Log in or Create an account to join the conversation.

More
7 years 2 months ago #82103 by TMSWhite
Another option is:
count(Q1_1, Q1_2, Q1_3, ..., Q1_n) > 1

Please Log in or Create an account to join the conversation.

More
7 years 2 months ago #82123 by ljanka
Replied by ljanka on topic Sum / count multiple choice
Thanks for you answers.
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?

Please Log in or Create an account to join the conversation.

More
7 years 2 months ago #82124 by Mazi
Replied by Mazi on topic Sum / count multiple choice
Too many options shouldn't be the problem.

Please attach your question group for testing.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com
Want to use your survey offline -> www.offlinesurveys.com

Please Log in or Create an account to join the conversation.

More
7 years 1 month ago #82188 by ljanka
Replied by ljanka on topic 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?
Attachments:

Please Log in or Create an account to join the conversation.

More
7 years 1 month ago #82192 by ljanka
Replied by ljanka on topic 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 !!!

Please Log in or Create an account to join the conversation.

More
7 years 1 month ago #82200 by TMSWhite
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 .

Please Log in or Create an account to join the conversation.

More
7 years 1 month ago #82264 by Mazi
Replied by Mazi on topic Sum / count multiple choice

ljanka wrote: 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
Want to use your survey offline -> www.offlinesurveys.com

Please Log in or Create an account to join the conversation.

More
7 years 1 month ago #82275 by TMSWhite
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.

Please Log in or Create an account to join the conversation.

More
7 years 1 month ago - 7 years 1 month ago #82283 by Mazi
Replied by Mazi on topic 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
Want to use your survey offline -> www.offlinesurveys.com
Last edit: 7 years 1 month ago by Mazi.

Please Log in or Create an account to join the conversation.

More
7 years 1 month ago #83005 by TMSWhite

TMSWhite wrote: 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 .

Please Log in or Create an account to join the conversation.

More
1 month 9 hours ago #186703 by l1bxr02
Replied by l1bxr02 on topic Sum / count multiple choice
Hi there
I am using Lime Survey 3.17.7 version.
Thanks
Babu

I am also using this equation under validation.
Is this right?

count((4.A.(1), (4.A.(2), (4.B.(1), (4.B.(2), (4.B.(3) )) > 1

Please Log in or Create an account to join the conversation.

More
1 month 8 hours ago #186704 by Joffm
Replied by Joffm on topic Sum / count multiple choice
No.
You see in the post below yours, how it may look like.

Depends on what you are going to sum.
Several questions, subquestions, arrays?

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in or Create an account to join the conversation.

More
1 month 6 hours ago #186708 by l1bxr02
Replied by l1bxr02 on topic Sum / count multiple choice
Hi There
Let us just do a simple 2 part sum.
4A1, 4A2 and 4B1, 4B2, 4B3 should be all = 4.C

Makes sense?
Thanks
Babu

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!