# Weight results by question group

3 months 4 days ago #175508
leandromp created the topic: Weight results by question group
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,

3 months 3 days ago #175538
DenisChenu replied the topic: Weight results by question group
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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

3 months 3 days ago #175543
leandromp replied the topic: Weight results by question group
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,

3 months 2 days ago #175554
DenisChenu replied the topic: Weight results by question group
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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

3 months 2 days ago #175555 by tpartner
tpartner replied the topic: Weight results by question group
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.

3 months 2 days ago - 3 months 2 days ago #175569
DenisChenu replied the topic: Weight results by question group

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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Last Edit: 3 months 2 days ago by DenisChenu.

3 months 2 days ago #175592
leandromp replied the topic: Weight results by question group
Thank you all so much for your help.
WIth that information, I was able to do the calculations needed.
Best regards!