Question

I'm a bit of a noobie working with SSRS 2008 and I'm having trouble trying to get the average of a sum of numbers. Here is how my report looks like (I couldn't put in a screen shot, hopefully the text table I created makes sense ):

Example |

ParentCode | ChildCode | Total Grade | A | B | A%    | B%

P1

             1234       5             1   4   20%     80%

               Totals   5             1   4   20%     80%

P2

             4567       6             3   3   50%     50% 

             5555       3             2   1   66.7%   33.3%

               Totals   9             5   4   58.35%  41.65%

I am calculating the percentage of grades for each ChildCode (ie. code 5555 has 2 A's out of 3 grades total, so its A% = 66.67%). I am doing this by using scope descriptors:

=sum(Fields!grade.Value)/sum(Fields!grade.Value,"gradePercCol")

Where the first sum's scope is by the row grouping (ChildCode) and the second sum is by the grade percent column grouping.

For whatever reason, I need to get the average of these percentages. Ie:

For parent code P2, I need the average for column A%: (50% + 66.67%) / 2 = 58.35, as well as for the B% column and so on. The "Totals row" in my example would be an example of what I need.

I think I need to make a custom aggregate since the original percentages are calculated using the sum function and I can't get an average of an aggregate function. However, I'm having a lot of trouble understnding the documentation for custom aggregates.

http://blogs.msdn.com/b/robertbruckner/archive/2008/07/20/using-group-variables-in-reporting-services-2008-for-custom-aggregation.aspx

http://technet.microsoft.com/en-us/library/bb934256(v=sql.100).aspx

Any help clarifying these links or pointing me in the right direction would be much appreciated. Thanks a lot!

Était-ce utile?

La solution

Do your clients realize that they are averaging averages?

I think the best solution would be to derive your grade percentage in your data set. If you can do that, then you can just do a avg(percentage) in your group footer.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top