Automatic calculated answer? | XM Community
Skip to main content
Hi all community members,



I am so new to Qualtrics and has very limited knowledge for online survey. I have another question which I have been trying to do it via Javascript and failed 😞.



!



So, when the participant writes the percentage (%) in the box, it automatically calculated the total amount of money willing to spend. Let say, the person response 10% and Qualtric automatically calculated 10% of the total weekly expenditure from previous question. Something like that. I don't know it is possible or not. Or I am too ambitious 😃



Best wishes

Nur
Qualtrics math operations might help.
@Nur8987 - Math calculations can be tricky at first, so I made a basic survey to illustrate how this must work. Import the attached .qsf by creating a new project and clicking "Create from Existing > From a File"



!





A few key things:

1. The easiest way to set up this calculation is to have them put the percentage value in as a whole number without a % symbol. (i.e. 10% = 10). I applied validation rules to make sure this happens



2. In the survey flow, notice how there are 2 question blocks, divided by 1 embedded data block. This is because the survey needs to create the calculated value before you can use it in piped text. The biggest downside of this is that you lose the back button function, so without additional logic, they can't change their answer. - I think this can be done with JavaScript too, but that isn't my area of expertise.
@Akdashboard thanks for the response, but I don't know how to open the attached file. Would you help me with it?



Nur 😃
@Akdashboard got it how to open it! Poor me, so bad with technology :(



Nur
@Nur8987 - Please save the file to your local drive (really just anywhere on your computer), then the first half of my post explains how t import it.
@Akdashboard I had tried it. It seems working but as you said the back button is missing which is weird for me. I even tried to write javascript to display the back button. If you have any idea how to make the back button appear again, please let me know. I also send email to support qualtrics to help me.



Best wishes to you

Nur
@Nur8987,



Anytime you put anything between two question blocks in the survey flow, Qualtrics disables the previous button. You can do anything to change it.



I've modified @Akdashboard's example to show that you don't have to do the math operation in the survey flow. If you just want to display the result, just put the math operation in the question text on a different page. If you need to save the result to an embedded data variable so it is in your response data, you can just add the embedded data block at the end of the survey flow, or you can do it with a one line JavaScript as shown in the example.
@TomG



Thank you for the info. I will look through the example you gave to me. Don't know how to show my gratitude for helping me a lot. Very much appreciated 😃



Best wishes

Nur
@TomG - This is great! I had no idea you could do math operations outside of the survey flow.



Re-reading Qualtrics' explanation for math operations and it is right there in black and white. I guess I just got so used to doing the work in the survey flow that I never considered anything else. I feel like I just leveled up, even though I don't have a specific use case for this function right now.

Leave a Reply