在ssrs报告中重复组的计数

时间:2016-02-23 16:28:46

标签: sql reporting-services count ssrs-2008 ssrs-2008-r2

我需要在下面的报告中计算3组的通过,失败或未参加人数。

请看这里:

报告 - > Result_Groups

查询:

CASE WHEN Description = 'FUNCTIONAL SKILLS - ENGLISH (LEVEL 1 & LEVEL  2)' THEN 'Overall' 
WHEN Description = 'ENGLISH (ENTRY LEVEL)' THEN 'Overall'
WHEN Description = 'FUNCTIONAL SKILLS ENGLISH' THEN 'Overall' 
WHEN Description = 'READING -ENGLISH LEVEL 2' THEN 'Reading' 
WHEN Description = 'READING- ENGLISH (LEVEL 1 )' THEN 'Reading' 
WHEN Description = 'E2  ENGLISH FUNTIONAL SKILLS READING' THEN 'Reading' 
WHEN Description ='E2 FUNCTIONAL SKILLS READING' THEN 'Reading' 
WHEN Description = 'E3 ENGLISH FUNTIONAL SKILLS READING' THEN 'Reading' 
WHEN Description= 'WRITING- ENGLISH (LEVEL 1 )' THEN 'Writing' 
WHEN Description = 'WRITING- ENGLISH LEVEL  2' THEN 'Writing' 
WHEN Description = 'E2 ENGLISH FUNCTIONAL SKILLS WRITING' THEN 'Writing' 
WHEN Description = 'E3 ENGLISH FUNCTIONAL SKILLS WRITING' THEN 'Writing' 
WHEN Description = 'SPEAKING & LISTENING- ENGLISH LEVEL 2' THEN 'Speaking & Listening' 
WHEN Description = 'SPEAKING & LISTENING- ENGLISH (LEVEL 1)' THEN 'Speaking & Listening' 
WHEN Description = 'E3 ENGLISH FUNCTIONAL SKILLS SPEAKING AND LISTENING' THEN 'Speaking & Listening' 
WHEN Description = 'E2 ENGLISH FUNCTIONAL SKILLS SPEAKING AND LISTENING' THEN 'Speaking & Listening' END AS CourseType,
CASE WHEN Grade = 'PA' THEN 'Pass' 
WHEN Grade = 'FL' THEN 'Fail' 
WHEN Grade = 'X' THEN 'Not Attended' END AS Grade

数据集:

SELECT DISTINCT 
STEN_Student_ID, STUD_Forename_1, STUD_Surname,  COUNT(Grade) AS Count_Grade, Course, Section, CourseType, Grade
FROM FS_Exams_English
GROUP BY  STEN_Student_ID, STUD_Forename_1, STUD_Surname,  Grade, Course,  Section, CourseType
ORDER BY STEN_Student_ID

让我知道我该怎么做。

1 个答案:

答案 0 :(得分:1)

现在,您在所有3列中显示相同的值。为了区分它们,您可以在数据集中为每列使用计算字段。

  1. 右键单击数据集,然后选择“添加计算字段...”
  2. 将第一个命名为“Pass_Value”并使用如下表达式:

    =IIf(<pass expression>, 1, 0)
    
  3. 注意:您需要在此处引用标识及格分数的列。

    1. 重复“失败”和“非参与”值的最后一步。
    2. 在您的表格中,参考您的3个计算字段以获得所需的输出。
    3. 修改

      感谢您发布查询。计算的字段表达式如下所示:

      =IIf(Fields!Grade.Value = "Pass", 1, 0)
      

      然后在表格中,您可以像这样引用它:

      =Sum(Fields!Pass_Calculated_Field.Value)