Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
RogerG
Creator
Creator

need help calculating a percent based on question in a survey

Hello all, I need to calculate a % of an answer to a particular question in a chart

I have this

=count(AnswerDuration)/count({1}TOTAL{<Function><Question={"$(vQuestion)"}>}AnswerDuration)

the question is "How long have you worked in the system?"

the possible values are 

0-6 months

6 months to 1 year

more than 1 year

 

there are 6 groups that answered this question, 

Where I am getting the error is here

{"$(vQuestion)"}>}AnswerDuration)

I've check this syntax against several others and cannot see an issue. 

and I've tried single quotes and no quotes. but the results don't return as expected.

TIA

 

Labels (1)
1 Solution

Accepted Solutions
Anonymous
Not applicable

In a pivot table...(I removed F1,Q1,A3 and added F2,Q3,b4 so that all numbers weren't 33%)

Dimensions: Function, Question and Answer

Expression: Count (Answer)/Count (Total <Function,Question>Answer)

1938464 pivot.png

HTH,

John

(aka johncaqc)

View solution in original post

3 Replies
Anonymous
Not applicable

Without the full dataset it, maybe...

=count(AnswerDuration)/count({1}TOTAL{<Function><Question={"$(=vQuestion)"}>}AnswerDuration)

I added an equal sign in the set expression. Single quotes may replace the double quotes too...try each.

HTH,

John

(aka johncaqc)

RogerG
Creator
Creator
Author

Neither combination worked, for a sample set of data, you can imagine

Function  Question Answer
F1, Q1, A1
F1, Q1, A2
F1, Q1, A3
F1, Q2, A1
F1, Q2, A2
F1, Q2, A3
F2, Q1, A1
F2, Q1, A2
F2, Q1, A3
F2, Q3, b1
F2, Q3, b2
F2, Q3, b3

so I need what percentage of F1 answered Q1 with A2

Anonymous
Not applicable

In a pivot table...(I removed F1,Q1,A3 and added F2,Q3,b4 so that all numbers weren't 33%)

Dimensions: Function, Question and Answer

Expression: Count (Answer)/Count (Total <Function,Question>Answer)

1938464 pivot.png

HTH,

John

(aka johncaqc)