Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I've survey responses presented like in below (multiple participants, multiple questions, 3 options to choose from per each question):
ID | Question_1 | Question_2 | Question_3 |
101 | Agree | Don't Know | Don't Agree |
102 | Agree | Agree | Don't Know |
103 | Don't Agree | Don't Agree | Don't Agree |
I would like to have the data for each question presented as horizontal stacked bar summing up to 100% (one bar per one question), similarily as below:
Could anyone help me/direct in a right way on how to achieve this form of presenting the results?
Thank you in advance
Hi Akaszon,
first adjust your script using CrossTable syntax function similar to:
table:
CrossTable(Question, Answer, 1)
load * Inline [
ID,Q1,Q2,Q3
1,Agree,Don't Know,Don't Agree
2,Agree,Agree,Don't Know
3,Don't Agree,Don't Agree,Don't Agree
];
Then create stacked horizontal bar chart using:
Dim (stack): Question
Dim (bars): Answer
Measure: Count(Answer)/count(total <Question>Answer)
Formatting in percentage.
Hope it helps.
BR
m
Hi Akaszon,
first adjust your script using CrossTable syntax function similar to:
table:
CrossTable(Question, Answer, 1)
load * Inline [
ID,Q1,Q2,Q3
1,Agree,Don't Know,Don't Agree
2,Agree,Agree,Don't Know
3,Don't Agree,Don't Agree,Don't Agree
];
Then create stacked horizontal bar chart using:
Dim (stack): Question
Dim (bars): Answer
Measure: Count(Answer)/count(total <Question>Answer)
Formatting in percentage.
Hope it helps.
BR
m
Hi Mato,
Many thanks for your answer.
About the CrossTable - is there any "automated" way to include all answers given to certain question? It sure can be done manually for 3 participants, but what if I have 100 participants?
Hi @Akaszon,
it is not a problem for crosstable syntax function. Check Qlik help site: https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Scripting/Scrip...
BR
m
Hi @mato32188 ,
I checked this link on Qlik help, but couldn't really find any information on how can I populate the "load * inline" part with all records falling under certain category (following the example that you've posted - instead of "1,2,3" I would like to have all the records stored as "Identifiers" in the data file that I've uploaded).
Still, I was able to paste the larger population manually and create the stacked bar, just the way you showed:
Thank you 🙂
Hi @Akaszon ,
instead of using "load inline", you can use standard load from any file, database or whatever supported by Qlik.
Script could look like:
CrossTable(Question, Answer, 1)
Load
Id,
Q1,
Q2,
Q3,
...
from "file", "db table", etc.;
BR
m