Quick Qualtrics Tricks #3 : Scale results calculation

Follow and Like:
Follow by Email
Follow Me

Qualtrics There are time when you’re running a Quatrics survey and would like to calculate the results during survey run on the fly and present this back to the user. Even if it’s not as straight forward there is an advanced way to do this with Qualtrics.


The most basic way to do this it to use Qualtrics feature of "Scoring" where you can give each response in each question a score and request that Qualtrics to present the user score at the end of the section or the survey. This is obviously mainly intended for tests where you want to present the user with feedback at the end.

If you have a simple scale it is possible to score the responses in a similar way and present a scale summary. You could also use that result with piped codes and embedded if you want a more elaborate feedback using another advanced Qualtrics feature called "Math Operations".


But one of my scenarios went beyond all that. For calculating the SVS Schwartz (Personal) Values Scale this is what I needed (taken from the draft manual 2009):

Scale Use Correction

Individuals and cultural groups differ in their use of the response scale. When treating value priorities either as independent or as dependent variables, it is necessary to correct for scale use. In such analyses, scale use differences often distort findings and lead to incorrect conclusions.

A. Compute each individual’s total score on all value items and divide by the total number of items. I call this the MRAT (Mean RATing for the particular individual).

B1. Center scores of each of the items for an individual around that individual’s MRAT. Then compute scores for the 10 values by taking the means of the centered items.

An example of the SPSS analysis for the SVS would be (taken from the MyPersonality WIKI entry):

compute mrat = mean(svs1 to svs57).

DO REPEAT  s = svs1 TO svs57 /

  t = t1 TO t57    .

COMPUTE t = (s – mrat).

END REPEAT            

compute tpo = mean(t3,t12,t27).

compute tac = mean(t34,t43,t55,t39).

compute the = mean(t4,t50,t57)        .

compute tst = mean(t9,t25,t37)         .

compute tsd = mean(t5,t16,t31,t41,t53)  .

compute tun = mean(t1,t17,t24,t26,t29,t30,t35,t38)   .

compute tbe = mean(t33,t45,t49,t52,t54).

compute ttr = mean(t36,t44,t51,t32,t18).

compute tco = mean(t11,t20,t40,t47)       .

compute tse = mean(t13,t15,t56,t8,t22)         .

compute topen=mean (tsd, tst).

compute tselfenh=mean (the, tac, tpo).

compute tselftran=mean (tun, tbe).

compute tconserv=mean (ttr, tco, tse).


So, to be able to calculate something as complex as that to be able to be able to show – for example – Openness to Change (topen), we need something more elaborate using a Javascript code.

James from Qualtrics support helped me out with the following :

in JavaScript within Qualtrics you will have to do something like this:

First you will need to add in a separate embedded data field into your survey flow for each of the values that you want included in your reports.

For example if I want "topen" and "tselfenh" to be included I would need both of them in my survey flow so that they appear like so:

Set Embedded Data on Qualtrics

You can add in as many fields as you want and need.

The JavaScript which needs to be near the end after all the questions and on a separate page from the questions whose values it uses.
It will be similar to the code below:
   var t3 = ${q://QID3/ChoiceTextEntryValue} ;    //This is piped text from the question you are pulling the data from you can get this code from the rich text editor by using the pipe text feature.
   var t12 = ${q://QID12/ChoiceTextEntryValue}; //The piped text is different for different types of input (text entry, multiple choice, etc.) and the QID for each question is different
   var t27 = ${q://QID27/ChoiceTextEntryValue}; //Each of these piped text fields will be unique to your survey.
   var t58 =  ${q://QID7/ChoiceTextEntryValue}; // One line for each variable that comes from a question.
   //compute tpo = mean(t3,t12,t27). Will be equal to something like:
var tpo = (t3+t12+t27)/3;
   var tac = (t34+t43+t55+t39)/4;
   var tse = (t13+t15+t56+t8+t22)/5;
   var topen = (tsd+tst)/2;
var tselfenh = (the+tac+tpo)/3;
   var tconserv = (ttr+tco+tse)/3;
   //This calculates all the means but does not save them to the survey.
   //If you want these values to be saved to the survey as embedded data you will need to code below:
   Qualtrics.SurveyEngine.setEmbeddedData(‘topen’,topen);          //This sets the embedded data, ‘topen’, to the value of the second variable, topen.
   Qualtrics.SurveyEngine.setEmbeddedData(‘tselfenh’, tselfenh);  //This also needs to be done individually for each of the embedded data fields that you want saved to the survey.

The code is not too complicated but the piped text is different for each survey and depends on what type of input you have and which questions you are using. If you need any help implementing it I would be more than happy to do so; all I would need is your user name and the name of the survey.



I can think of many ways to use this functionality, and I’m guessing this approach to Qualtrics isn’t that obvious evento the most advanced Qualtrics users. Essentially, this allowed me to get a person to take the SVS, calculate the SVS and give the participant a feedback right on the spot. Naturally, this also allows me to save those new scale variables.


Hope that helps you somehow and gives you a few new ideas.

Notify of
Newest Most Voted
Inline Feedbacks
View all comments
8 years ago

are you sure it’s:

var t3 = ${q://QID3/ChoiceTextEntryValue};

and not:

var t3 = ‘${q://QID3/ChoiceTextEntryValue}’;


when I don’t put quotation marks around the ${q://QID3/ChoiceTextEntryValue}, the // turns everything after it into a comment.

Gilad Feldman
8 years ago
Reply to  pretendous

yeah, I think you’re right. thanks for catching that and reporting back.

4 years ago

Wouldn’t “Math Operations” help with some of these simple cases as well? https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/piped-text/math-operations/