title: SSRS Summing Distinct Values of Specific Group
body: <p>In SSRS, there are 2 groups and 1 detail row that I am trying to total the distinct value of each group.</p>
  
  <p>group 1 = 1 school</p>
  
  <p>group 2 = 5 students</p>
  
  <p>detail = 4 classes taken by each of the 5 students</p>
  
  <p>field 1 = student name</p>
  
  <p>field 2 = number of previously taken courses (use the numbers 2,4,6,8,10)</p>
  
  <p>field 3 = course names of current schedule (ELA, math, science, social studies)</p>
  
  <p>My dataset has 20 rows representing each of the 5 students taking 4 classes each.
  On the report, there are no totals in the details row.
  In the student group row, when I pull just the value (not the sum) of the previously taken courses, it correctly displays in the column as 2,4,6,8,10 depending on the student, of course, because it is part of the grouped by expression. </p>
  
  <p>Here's where we get to the problem. When group 1 is totaled in the previously taken courses column, the total comes up 4 times the value I expect. Presumably, the report is totaling all 20 entries instead of grouping them by distinct student value. </p>
  
  <p>The report display should look like 1 row for school, 5 sub rows below school showing the students and the number of previously taken courses, and then finally 4 sub rows below each students with the course names listed.</p>
  
  <p>I know the distinct count function will not help because the values need to be totaled not counted. I tried Sum(Fields!prevCount.Value,"GroupBystudent" but that didn't work either. I have tried referencing the ReportItems!Textbox.Value and I got an error that said it needed to be done in the header or footer.</p>
  
  <p>Can this even be done? If so, could you please help me with the Expression?
  Many thanks.</p>