【问题标题】:Stacked bar chart in Qlik Sense: one bar for one fieldQlik Sense 中的堆积条形图:一个栏对应一个字段
【发布时间】:2018-03-28 08:50:19
【问题描述】:

我有这张桌子:

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 中都很难......这些程序不接受我想将一个字段/列汇总到一个栏中。

我想要的结果应该类似于:

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

【问题讨论】:

    标签: bar-chart stacked-chart qliksense stackedbarseries


    【解决方案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;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-16
      • 2020-07-03
      • 1970-01-01
      相关资源
      最近更新 更多