如何根据多个下拉列表中的选定维度创建视图

时间:2016-03-22 16:52:22

标签: tableau tableau-public

我想创建一个单独的视图,根据每个科目的PASS / FAIL等级,给出我在性别和年龄方面的学生总数。

我的架构和数据集如下。

 (id,name,age,Gender,english_grade,Mathematics_grade,Physics_grade,chemistry_grade,grade_ind)

   100  Steve   14  MALE    PASS    PASS    PASS    PASS    Y
   101  Edward  15  MALE    PASS    FAIL    PASS    PASS    Y
   102  Andy    15  FEMALE  PASS    FAIL    PASS    PASS    Y
   103  Kim     16  FEMALE  PASS    FAIL    PASS    PASS    Y
   104  Tammy   14  FEMALE  PASS    FAIL    PASS    PASS    Y
   105  Sue     15  FEMALE  PASS    FAIL    PASS    PASS    Y
   106  Chen    15  MALE    PASS    FAIL    PASS    PASS    Y
   107  Kim     16  FEMALE  PASS    FAIL    PASS    PASS    Y
   108  Jim     14  MALE    PASS    FAIL    PASS    PASS    Y
   109  Annie   15  FEMALE  PASS    FAIL    PASS    PASS    Y
   110  Anna    15  FEMALE  PASS    FAIL    PASS    PASS    Y
   111  Royce   16  MALE    PASS    FAIL    PASS    PASS    Y
   112  Mike    14  MALE    PASS    FAIL    PASS    PASS    Y
   113  Peter   15  MALE    FAIL    FAIL    PASS    PASS    Y
   114  Board   15  MALE    FAIL    FAIL    PASS    PASS    Y
   115  Andrew  16  MALE    FAIL    FAIL    FAIL    FAIL    N
   116  William 14  MALE    FAIL    FAIL    FAIL    FAIL    N
   117  Santa   15  MALE    FAIL    FAIL    FAIL    FAIL    N
   118  Sandy   15  MALE    FAIL    FAIL    FAIL    FAIL    N
   119  Danny   16  MALE    FAIL    FAIL    FAIL    FAIL    N
   120  Melisa  14  FEMALE  FAIL    FAIL    FAIL    FAIL    N
   121  Merlin  15  FEMALE  FAIL    FAIL    FAIL    FAIL    N
   122  Betsy   15  FEMALE  FAIL    FAIL    FAIL    FAIL    N
   123  Bill    16  MALE    FAIL    FAIL    FAIL    FAIL    N

我使用参数创建了4个下拉列表,但不知道如何为这些下拉列表应用计算字段。

enter image description here

所以,现在按照上面的选择,我想要一个视图,它给出了在化学和英语和物理方面获得PASS但在数学方面失败的性别方面的学生总数。

基本上我想将计算应用为

 IF(chemistry = 'PASS' AND English ='PASS' AND Physics = 'PASS' AND Maths ='FAIL')

同样根据这4个下拉列表中的每一个的相应选择,我希望我的观点得到反映。

其他一些可能的选择

  IF(chemistry = 'PASS' AND English ='FAIL' AND Physics = 'FAIL' AND Maths ='FAIL')

 IF(chemistry = 'FAIL' AND English ='PASS' AND Physics = 'PASS' AND Maths ='FAIL')

 IF(chemistry = 'PASS' AND English ='PASS' AND Physics = 'PASS' AND Maths ='PASS')

我尝试了以下计算字段,但未显示正确的视图。

CASE [chemistry]
WHEN 'PASS' then [Chemistry Grade]
WHEN 'FAIL' then [Chemistry Grade]
ELSE ''
END

感谢任何帮助...

1 个答案:

答案 0 :(得分:0)

您可以尝试将其转换为总和,而不是计算。尝试这样的东西作为起点:

SUM(IF(chemistry = 'PASS' AND English ='PASS' AND Physics = 'PASS' AND Maths ='FAIL') THEN 1 ELSE 0 END)