Sum of distinct in SSRS

2019-09-05 09:51发布

I have to get distinct rows sum in SSRS expression.

**StudentId  TestScoreMath   CurriculumEnrolled      EnrollStatus**

  100              200            Nursing             Enrolled

  100              200            Physical              Enrolled

  200              100             Tech                Enrolled

Total Student TestScoreMath should be 300 not 400. I tried using the expression

=Sum(Fields!TestScoreMath .Value, "table1_Group3")

How can I SUM the value of TestScore of distinct students? I need this only in SSRS.

1条回答
迷人小祖宗
2楼-- · 2019-09-05 10:23

In SSRS 2005, this is not too easy. I would add embedded code to keep a running total. You can have the custom code to check to see if the current student ID matches the last. If so, then don't add another test score to the total. Or you could group by Student ID and call your custom code only in the header or footer of that group.

This sample shows totaling all rows: you'll need to add to this to track the studentID.

查看更多
登录 后发表回答