Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
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
JohnInSD
Contributor III
Contributor III

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
JohnInSD
Contributor III
Contributor III

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

JohnInSD
Contributor III
Contributor III

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)