Question T14286
Visible to All Users

Calculate a total from 3 columns in a multi select matrix

created a year ago

Hi,

I am wanting to calculate the total value of each column and add them together - please see image Clipboard-File-1.png

So for example Trial 1 = 5, Trial 2 = 7, Trial 3 = 5, I would like it to calculate these 3 totals added together = 17

I have tried an expression to calculate all 3 columns together, but it only seems to calculate one column. Please can you help?

JSON
{ "type": "matrixdropdown", "name": "question104", "title": "LIST A", "hideNumber": true, "columns": [ { "name": "Column 1", "title": "Trial 1", "totalType": "sum" }, { "name": "Column 2", "title": "Trial 2", "totalType": "sum" }, { "name": "Column 3", "title": "Trial 3", "totalType": "sum" } ], "choices": [ "0", "1" ], "cellType": "radiogroup", "columnColCount": 2, "rows": [ { "value": "Row 1", "text": "Jacket" }, { "value": "Row 2", "text": "Arrow" }, { "value": "Row 3", "text": "Pepper" }, { "value": "Row 4", "text": "Cotton" }, { "value": "Row 5", "text": "Movie" }, { "value": "Row 6", "text": "Dollar" }, { "value": "Row 7", "text": "Honey" }, { "value": "Row 8", "text": "Mirror" }, { "value": "Row 9", "text": "Saddle" }, { "value": "Row 10", "text": "Anchor" } ], "totalText": "TRIAL TOTAL" },

Answers approved by surveyjs Support

created a year ago

Hello Lottie,
You can access them as: {questioName-total.ColumnName}

JavaScript
{ name: "total", type: "expression", title: "Total", expression: "{question104-total.Trial 1} + {question104-total.Trial 2} + {question104-total.Trial 3}", }

Thank you,
Andrew
SurveyJS Team