Welcome to the LimeSurvey Community Forum

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

Displaying Monthly Summarized Responses for a Multiple-Choice Question

  • doesthiswork
  • doesthiswork's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
4 months 1 week ago - 4 months 1 week ago #253460 by doesthiswork
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 3.28.47
Own server
==================
Hi,

I am currently trying to figure out how to display the sum of responses to a multiple-choice question beneath the question itself.

The multiple-choice question asks for one of the following responses: daily, weekly, or monthly.

I would like to use a text display under the question to show how many times each option has been selected.

As a bonus feature, I'm interested in showing only the stats for the current month. Therefore, it might be useful to limit the summation to responses from the current month only.

Does anyone have any suggestions on how to achieve this?
Last edit: 4 months 1 week ago by doesthiswork.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 months 1 week ago #253461 by Joffm
Hi,
in your version you can use the plugin "getStatInSurvey"
[url] gitlab.com/SondagesPro/ExportAndStats/getStatInSurvey [/url]
This gives you the oppotunity to count the frequencies of your three options.
Code:
[Qcode.nb.A1]
: shows the number of answer A1 to question Qcode

To get a monthly display I should say, you combine the actual month with the given answer in an equation (like "01_1",... "06_2", "10_3" and count these. 
Just an idea. If I have time I will try.

Joffm

BTW:
Since version 5.x. there is a core plugin "statFunctions".


 

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

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 months 1 week ago #253465 by Joffm
Hi,
just to confirm:
My mentioned idea works.
In  an equation (eqQ1) after your question (Q1) enter
{join(date('m'),Q1)}
"date('m') returns the two digit number of the month (01...12)

And where you want to display the result, enter a nested IF like
for the answer option with code "1"
{if(date('n')==1,'[eqQ1.nb.011]',if(date('n')==2,'[eqQ1.nb.021]',if(date('n')==3,'[eqQ1.nb.031]',if(date('n')==4,'[eqQ1.nb.041]',if(date('n')==5,'[eqQ1.nb.051]',if(date('n')==6,'[eqQ1.nb.061]',if(date('n')==7,'[eqQ1.nb.071]',if(date('n')==8,'[eqQ1.nb.081]',if(date('n')==9,'[eqQ1.nb.091]',if(date('n')==10,'[eqQ1.nb.101]',if(date('n')==11,'[eqQ1.nb.111]',if(date('n')==12,'[eqQ1.nb.121]',''))))))))))))}

"date('n')" returns the number of the month (1...12)
You see "011", "021", "031", ... is the joined two digit month number and the answer option code.
what we did in the equation "eqQ1"

And I added it to the answer option directly and added the total number with [Q1.nb.1]
And to display the month name ? "date('F')"
See
[url] www.php.net/manual/en/datetime.format.php [/url]

Rough example without a better styling
 

Joffm
 

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

Please Log in to join the conversation.

  • doesthiswork
  • doesthiswork's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
4 months 1 week ago #253499 by doesthiswork

Hi,
in your version you can use the plugin "getStatInSurvey"
[url] gitlab.com/SondagesPro/ExportAndStats/getStatInSurvey [/url]
This gives you the oppotunity to count the frequencies of your three options.
Code:
[Qcode.nb.A1]
: shows the number of answer A1 to question Qcode

To get a monthly display I should say, you combine the actual month with the given answer in an equation (like "01_1",... "06_2", "10_3" and count these. 
Just an idea. If I have time I will try.

Joffm

BTW:
Since version 5.x. there is a core plugin "statFunctions".
Thank you so much for your help! I was going to update my current instance to 6.x, since 3.x has been discontinued in june. There are still updates but who knows for how long. The plugin will also be availble in 6.x, right?

I will spin up a limesurvey 6.x instance and copy the current state of the survey over and try your suggestion!

Thanks so much!

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 months 1 week ago - 4 months 1 week ago #253503 by Joffm

The plugin will also be availble in 6.x, right?

As I wrote:
Since version 5.x. there is a core plugin "statFunctions" which you can use.

Using this you avoid the nested IF with only
{statCountIf(eqQ1.sgqa, join(date('m'),1))}
with "1" as the code of the first answer option.

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 4 months 1 week ago by Joffm.
The following user(s) said Thank You: tpartner

Please Log in to join the conversation.

  • doesthiswork
  • doesthiswork's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
4 months 1 week ago #253630 by doesthiswork

The plugin will also be availble in 6.x, right?

As I wrote:
Since version 5.x. there is a core plugin "statFunctions" which you can use.

Using this you avoid the nested IF with only
{statCountIf(eqQ1.sgqa, join(date('m'),1))}
with "1" as the code of the first answer option.

Joffm

 
Spun up a limesurvey 6.x instance and tested it out with my current survey. Worked like a charm. Thank you so much.

Only thing I had trouble first, was activating the StatFunctions plugin. I had to press Scan files to install it. Wasn't metioned anywhere on the  manual.limesurvey.org/StatFunctions page.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 months 1 week ago #253644 by tpartner

Only thing I had trouble first, was activating the StatFunctions plugin. I had to press Scan files to install it. Wasn't metioned anywhere on the manual.limesurvey.org/StatFunctions page.

The manual is a wiki. You should be able to add it.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 months 1 week ago #253667 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.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose