- Posts: 4
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Adding the Total & Average of a set of Questions
- rock049
- Topic Author
- Offline
- New Member
Less
More
5 years 21 hours ago #183563
by rock049
Adding the Total & Average of a set of Questions was created by rock049
I want to simply add the results of a set of questions within another question (which will be hidden) so it will show up in the database. So if I have Q1, Q2, Q3, Q4, and Q5 which are all Question Type: List (radio) and the resulting answers will show numbers 1-5 for each of the answers selected I would like Field T1 (Question Type: Equation) to include the sum of those numbers. I tried to input a couple of different options like Q1+Q2+Q3+Q4+Q5 or {SUM(Q1,Q2,Q3,Q4,Q5)} into the Question but the first one one sent me all the numbers not the totals and the second one has an error in the logic file which I have attached. I assume this equation goes in the Question field not in the Equation field but I have tried it in both places.
I would also like to do this for the average of these questions. So if I have Q1, Q2, Q3, Q4, and Q5 which are all Question Type: List (radio) and the resulting answers will show numbers 1-5 for each of the answers selected I would like Field A1 (Question Type: Equation) to include the average of those numbers. I assume that if I get the correct syntax above that the average syntax might be something like {SUM(Q1,Q2,Q3,Q4,Q5) / COUNT(Q1,Q2,Q3,Q4,Q5)} or something like that since I do not see an average function in EM.
I searched through the Forum but did not find anyone who seemed to have addressed this question. I would appreciate any direction on what I am missing in my syntax or where I am placing the syntax.
I would also like to do this for the average of these questions. So if I have Q1, Q2, Q3, Q4, and Q5 which are all Question Type: List (radio) and the resulting answers will show numbers 1-5 for each of the answers selected I would like Field A1 (Question Type: Equation) to include the average of those numbers. I assume that if I get the correct syntax above that the average syntax might be something like {SUM(Q1,Q2,Q3,Q4,Q5) / COUNT(Q1,Q2,Q3,Q4,Q5)} or something like that since I do not see an average function in EM.
I searched through the Forum but did not find anyone who seemed to have addressed this question. I would appreciate any direction on what I am missing in my syntax or where I am placing the syntax.
Attachments:
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13624
- Thank you received: 2490
5 years 16 hours ago #183568
by DenisChenu
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.
Replied by DenisChenu on topic Adding the Total & Average of a set of Questions
sum !== 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.
- rock049
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
5 years 12 hours ago #183591
by rock049
Replied by rock049 on topic Adding the Total & Average of a set of Questions
Changing to a lower case of SUM {sum(Q1,Q2,Q3,Q4,Q5)} passed the logic check however the result is 0 (see Responses attached)
If I simply do this Q1+Q2+Q3+Q4+Q5 it will give a result something like this 3+3+5+2+2 (based on the Codes and Answers you see attached).
What is causing the 0 in this question field after running through an assessment?
If I simply do this Q1+Q2+Q3+Q4+Q5 it will give a result something like this 3+3+5+2+2 (based on the Codes and Answers you see attached).
What is causing the 0 in this question field after running through an assessment?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3591
5 years 12 hours ago - 5 years 12 hours ago #183593
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Adding the Total & Average of a set of Questions
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 12 hours ago by tpartner.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- rock049
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
5 years 11 hours ago #183597
by rock049
Replied by rock049 on topic Adding the Total & Average of a set of Questions
Unfortunately that still resulted in "0"
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12908
- Thank you received: 3970
5 years 10 hours ago #183602
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Adding the Total & Average of a set of Questions
Hi,
instead of talking too much without exact knowledge, please send us your sample *.lss.
I just created your design, 5 radio questions with codes 1-5, equation question {sum(Q1,Q2,Q3,Q4,Q5)}
And got the correct result.
Version 3.15.5+181115
Joffm
instead of talking too much without exact knowledge, please send us your sample *.lss.
I just created your design, 5 radio questions with codes 1-5, equation question {sum(Q1,Q2,Q3,Q4,Q5)}
And got the correct result.
Version 3.15.5+181115
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- rock049
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
5 years 10 hours ago #183607
by rock049
Replied by rock049 on topic Adding the Total & Average of a set of Questions
Here it is, thanks!
Version 3.17.2+190408
Version 3.17.2+190408
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13624
- Thank you received: 2490
5 years 10 hours ago #183609
by DenisChenu
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.
Replied by DenisChenu on topic Adding the Total & Average of a set of Questions
Can you create a new survey, with only this 5 questions and check again …
If some question have relevance, you must use .NAOK
If some question have relevance, you must use .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.