# Weight results by question group

1 year 2 days ago #175508
Hello all,

I believe my question is fairly simple, but I cant't find the answer here on the forum.

I have a survey with 10 Question Groups. Each question group has a different number of "yes/no" questions and multiple choice questions.

For each "yes/no" question that a person answer "YES", he should get 1 point. For each multiple question that the person "checks the box", he should get 1 point (for each box checked).

The problem is that I have 138 possible points in total, and each Question Group should be weighetd different on my final score from 0 - 100.

Example:

Group 1 has 30 points possible, but it's weight in the final score is 20.
GRoup 2 has 10 points possible, but it's weight in the final score is 15.
etc...

I have done the calculations so that the sum of the weight of all the groups equals 100.

Is it possible to calculate the score based on these weights, so I have a final score from 0 to 100?

Best regards,

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

LimeSurvey Partners
1 year 2 days ago #175538
It's mathematic, not related to limesurvey, no ?

{sum(
(ScoreGroup1 / 30 ) *20,
(ScoreGroup2 / 10 ) *15,

)}

Each ScoreGroup are equation question type where you do your sum like this (for example)

{sum(
intval(Q01.NAOK == "Y"),
intval(Q02.NAOK == "N"),
intval(!is_empty(M_SQ1.NAOK)),
intval(is_empty(M_SQ2.NAOK)),

)}

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

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

1 year 1 day ago #175543
Thank you for your help, Denis. I believe you are absolutely correct.

However, when I try to sum the total of answers from a Question Group, I always end up with zero as result.

I am using the formula below to sum the results from 3 multiple choice questions. Is that the correct formula?

{sum(G3Q00001_SQ002.NAOK,G3Q00001_SQ003.NAOK,G3Q00001_SQ004.NAOK,G3Q00001_SQ005.NAOK,G3Q00002_SQ001.NAOK,G3Q00002_SQ002.NAOK,G3Q00002_SQ003.NAOK,G3Q00003_SQ001.NAOK,G3Q00003_SQ002.NAOK)}

Best regards,

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

1 year 1 day ago #175554
sum("Y","Y") do always 0 …

If you want count, then use count …

I put a sample where you can check "sq1 is checked","sq2 is not checked" etc … with sum …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

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

1 year 1 day ago #175555 by tpartner
With multiple choice, this will return a value of 1:

{G3Q00001_SQ002.NAOK == 'Y'}

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.

1 year 1 day ago - 1 year 1 day ago #175569

tpartner wrote: With multiple choice, this will return a value of 1:

{G3Q00001_SQ002.NAOK == 'Y'}

Yes, in general … i have some issue using sum with boolean value. Now , i always force it to be an integer.

Maybe difference between php and js too

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .
Last edit: 1 year 1 day ago by DenisChenu.

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

1 year 18 hours ago #175592
Thank you all so much for your help.
WIth that information, I was able to do the calculations needed.
Best regards!

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