0

我有这张桌子:

Survey1:
LOAD * inline [
Respondent, AnswerToQuestion1, AnswerToQuestion2
resp1, 1, 1
resp2, 1, 2
resp3, 2, 1
resp4, 2, 1
resp5, 2, 3
resp6, 2, 1
resp7, 2, 1
resp8, 3, 2
resp9, 3, 2
];

我想从这些数据中得到一个 100% 的堆积条形图。但是在 Excel 和 Qlick Sense 中都很难……这些程序不接受我想将一个字段/列汇总到一个栏中。

我想要的结果应该类似于:
堆积条形图 100%

Qlik Sense 中有没有办法做到这一点?

4

1 回答 1

1

我认为您想更改使用unpivot / crosstable对数据进行建模的方式-这将创建一个更像:

Respondent, Question, Answer
resp1, Question1, 1
resp1, Question2, 1
resp2, Question1, 1
resp2, Question2, 2

然后,您可以制作一个具有 2 个维度的堆积条形图 - 问题和答案,count(Answer)/count(TOTAL<Respondent>Answer)作为您的衡量标准,为您提供一个百分比。注意:我还没有测试过该代码——我会从一个包含这两个维度的表格开始并count(Answer)作为衡量标准——然后检查它是否count(TOTAL<Respondent>Answer)给出了您期望的答案总数。

在脚本编辑器中,假设您的表名为“Answers”,这可以通过以下方式完成:

Answers_new:
crosstable(Question,Answer,1)
Load * resident Answers;
drop table Answers;
rename table Answers_new to Answers;
于 2018-04-11T12:07:15.877 回答