# Average score of a group of questions

1 year 2 months ago #160260 by pachos
pachos created the topic: Average score of a group of questions
Hi everyone,

I have a survey with 6 groups of questions, and all the answers to these questions are on list radio from number 1 to 10.
I need that in the results of the survey, shows the average score of each group, and save it to the DB so I could print later the results.
For example:
(group) Social = 7
(group) Health = 8
(group) Financial = 5

Also I need to show an image next to the numeric result if the average score is between 3 scores.
For example:
If the average score is between 0 and 3, the result shows an A.png next to the numeric result
If the average score is between 4 and 6, the result shows an B.png next to the numeric result
If the average score is between 7 and 10 the result shows an C.png next to the numeric result

1 year 2 months ago #160264 by Joffm
Joffm replied the topic: Average score of a group of questions
Hello, pachos,
there is no implemented function "average".
So you have to do it the usual way.
In an equation sum up the values {sum(Q1.NAOK,Q2.NAOK,...)]
and divide by the count of questions {count(Q1,Q2,...)} By the way, you know the number of questions in the group.
See https://manual.limesurvey.org/Expression_Manager#Access_to_Functions
This value is stored in the database.

And you'd like to display an image depending on this average.
Here the buzzword is "Tayloring".
https://manual.limesurvey.org/Expression_Manager#Tailoring_.2F_Piping

Something like: <img src={if(average<4,"A.png",if(average<7,"B.png","C.png"))}>

Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: tpartner

1 year 2 months ago - 1 year 2 months ago #160293 by pachos
pachos replied the topic: Average score of a group of questions
Thank you very much Joffm.

Do I have to use an Equation question type? or can I Continue using List radio type?

So, these equations and tayloring, goes at the end of each group of questions?

And, I would be able to export to pdf the "average" results and the images??

Last Edit: 1 year 2 months ago by pachos. Reason: I forgot to ask something else

1 year 2 months ago - 1 year 2 months ago #160294 by Joffm
Joffm replied the topic: Average score of a group of questions
Hello, nachos,

I do not understand.
You have your radio lists and you calculate sum and average in an equation.
you can put one equation at the end of each group or the equations at the end of the survey, up to you.

If you put your pictures into an question of type text display it will be in the report.
https://manual.limesurvey.org/Expression_Manager_examples#Create_a_summary_page_using_placeholders

Just try.

In case, send your survey, just a sample with the problematic questions.

Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last Edit: 1 year 2 months ago by Joffm.

1 year 2 months ago #160301 by pachos
pachos replied the topic: Average score of a group of questions
Thanks for your help and patience, but I still have some problems with the survey.

I have attached a survey sample. It contains only 2 groups of questions. The "average" score of each group doesn't appear in the statistics nor the end of the group when the survey is answered. I've put the equations at the end of each group.

Also, I don't know where to upload the images to be show with the results, according the "average" score in the results of each group. Need to be included in the report.

Thanks again Joffm!
##### Attachments:

1 year 2 months ago - 1 year 2 months ago #160303 by Joffm
Joffm replied the topic: Average score of a group of questions
Hello, nachos,
1. how do you calculate the mean of the following texts: A3, B7, C2, D1?
That's what you are trying.
Of course the codes have to be numerical. (1,2,3,4,5,...)

2. Wrong brackets in your equation. The "/" has to be inside the equation.

3. Why did you enter the assessment values? You do not use this in your survey.

4. The pictures can be anywhere in the Internet, as long as you enter the correct url.
If you upload them to your template you can use the placeholder {TEMPLATEURL} to enter the correct path.

I corrected the errors(codes only in grupo 2).

You can hide the boilerplate question; but only by adding the css class "hidden". I did that.
You should hide the equation questions as well.

#### File Attachment:

File Name: limesurvey...1-05.lss
File Size:50 KB

Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
##### Attachments:
Last Edit: 1 year 2 months ago by Joffm.
The following user(s) said Thank You: pachos

1 year 2 months ago - 1 year 2 months ago #160307 by Joffm
Joffm replied the topic: Average score of a group of questions
Hello, nachos,

maybe I misunderstood. You never mentioned assessments before.

So if you want to use assessments, it is not necessaray to calculate a mean to show the appropriate picture. You can calculate it to display the mean in your summary.

E.g. grupo 2:
All questions are mandatory.
If sum between 4 and 15 -> mean <4
If sum between 16 and 27 -> 4 <= mean <7

So you have to define assessment rules like:
grupo
grupo 2
minimum: 4
maximum: 15
title: [something you like]
message: Your message; here you can include the calculated mean {summo} and the [link to picture small mean] (just use the editor)

Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
##### Attachments:
Last Edit: 1 year 2 months ago by Joffm.

1 year 2 months ago #160310 by pachos
pachos replied the topic: Average score of a group of questions
Thanks a lot Joffm!

I used assessments in the survey sample because I saw some examples in the forum using assessments, so it's not mandatory to use it in my survey.

So, if I used the survey that you've attached, would be able to show the result in a report as the image that you show in your last reply?
The following user(s) said Thank You: LouisGac

1 year 2 months ago #160313 by pachos
pachos replied the topic: Average score of a group of questions
I mean, the survey is not public nor anonymous. I'm going to send invitations (tokens), and when the participants finish the survey, I want to print/export (to PDF) the report of each participant as the image that you've attached. Example

- (Name of participant)
- title of Survey

- Name of group of questions 1
- "Average" Score :
- (with the image accordding the "average" score)

- Name of group of questions 2
- "Average" Score :
- (with the image accordding the "average" score)

and so on.....

I don't need to print/export all the questions and answers of each group.

1 year 2 months ago #160325 by LouisGac
LouisGac replied the topic: Average score of a group of questions
also, in LS3, assesments page can be customized from templates :
github.com/LimeSurvey/LimeSurvey/blob/de...ews/assessments.twig

1 year 2 months ago #160336 by Joffm
Joffm replied the topic: Average score of a group of questions
Hi, pachos,

if you import and run the survey I attached, you will see the following.after "imprimir repuestas".

And you can print it.

Now the rest is your turn.

By the way: Did you set the tet color of the questions to "white"?
This is done by the template.
And in your report you do not see the text.

Best regards
Joffm

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

1 year 2 months ago #160341 by pachos
pachos replied the topic: Average score of a group of questions
Hi Joffm,

I've tested the survey and I see that you say. But this "button" is for the participants, right?
Is there any option to see this results in the statistics (backend), as the sample survey (imprimir respuestas)??

1 year 2 months ago #160342 by Joffm
Joffm replied the topic: Average score of a group of questions
Hi, pachos,

of course this is a feature for the respondents.

LS is mainly to collect data and not to show and analyse results.

I am sure you can do this in any analyse tool or even in EXCEL with some macros.

In my opinion the best way for something like a live report is to create your own tool with a little bit of php (or other) and some chart library.

Regards
Joffm

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

1 year 2 months ago #160343 by pachos
pachos replied the topic: Average score of a group of questions
Thank you Joffm,

I'm new in this tool and I don't know well the reach of LS yet. You've helped me a lot. I hope this will be the last question of the tread.

Can I modify the style and the data of the pdf file "imprimir respuestas"?? I only want to show to the respondents the "average score" of the group, hidding all the questions and answers.

Thanks again