Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Weight results by question group

  • leandromp
  • leandromp's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 5 months ago #175508 by leandromp
Weight results by question group was created by leandromp
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,
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 5 months ago #175538 by DenisChenu
Replied by DenisChenu on 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 , plugin development .
I don't answer to private message.
The topic has been locked.
  • leandromp
  • leandromp's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 5 months ago #175543 by leandromp
Replied by leandromp on 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,
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 5 months ago #175554 by DenisChenu
Replied by DenisChenu on 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 , plugin development .
I don't answer to private message.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 5 months ago #175555 by tpartner
Replied by tpartner on 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.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 5 months ago - 5 years 5 months ago #175569 by DenisChenu
Replied by DenisChenu on 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 , plugin development .
I don't answer to private message.
Last edit: 5 years 5 months ago by DenisChenu.
The topic has been locked.
  • leandromp
  • leandromp's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 5 months ago #175592 by leandromp
Replied by leandromp on 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!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose