我需要在下面的报告中计算3组的通过,失败或未参加人数。
请看这里:
查询:
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
让我知道我该怎么做。
答案 0 :(得分:1)
现在,您在所有3列中显示相同的值。为了区分它们,您可以在数据集中为每列使用计算字段。
将第一个命名为“Pass_Value”并使用如下表达式:
=IIf(<pass expression>, 1, 0)
注意:您需要在此处引用标识及格分数的列。
修改强>
感谢您发布查询。计算的字段表达式如下所示:
=IIf(Fields!Grade.Value = "Pass", 1, 0)
然后在表格中,您可以像这样引用它:
=Sum(Fields!Pass_Calculated_Field.Value)