# How to sort crystal report by calculated group percentage

Hello,
I am new to Crystal Reports 11 and would like to sort a report by a calculated value within each group.  Specifically, I have a report of Tests (detail) grouped by Student.  Each test has an nPassed field (0 = failed, 1 = passed).  I would like to calculate the percentage of tests passed for each student, then sort the report by that value (while retaining the grouping by Student).   The result would look like:

Test    Passed
-----    ----------
Student:  Smith, John    90% passed
Test1   1
Test2   1
Test3   0
.... etc.
Student:  Bishop, Billy   85% passed
Test1   1
Test2   0
Test3   0
... etc.

Each student might have a different number of tests.  I hope to add some drilldown and charting later, once I've got the sort correct so that the top students are at the top of the report.
TIA,
Larry
###### Who is Participating?

Commented:
You can get the % with a formula like

Sum({nPassed},{StudentID}) / Count({nPassed},{StudentID})

You may be able to sort on it.

mlmcc
0

Author Commented:
Thanks for the reply mlmcc.  I am able to create the formula you describe, which is interesting because of the use of a grouping parameter in the sum() and count() functions.  Unfortunately, I do not believe the results can then be applied to the group order;  at lease the resulting nPercentPassed formula field is not available under the Group expert Options / Common / Sort options.  I think this is because only simpler "first pass" fields and variables can be used at that point and that the group parameters in the nPercentPassed formula functions presuppose that grouping and group ordering has already happened.  I may have to do the sorting in my database before sending the data to Crystal, but still appreciate the information about the formula.
-- Larry

BTW, this is my first question on EE and the whole "point" thing is new to me.  Since I apparently have unlimited points because of my subscription, is there any reason to not always set the point value to 500?  I'm happy to reward the help.  Or would this cause a sort of inflation that would undermine the meaning of the a point.  I picked 125 for this first question because the FAQ scale suggested this was the proper value for a basic question of moderate urgency.  Do people really post a range of values? or is everyone offering 500?  Does it matter?  Any thoughts on how this works would be appreciated.
0

Commented:
Points are explained in the HELP
http://www.experts-exchange.com/help.jsp#hs8

There is no reason to not offer 500 points.

Originally you only had limited question points and earned them in a variety of ways.  Thus the idea of assigning points to a quesiton and trying to get the most for your \$.  You could buy points in I think 1000 or 2000 point increments.

A few years ago EE added the monthly fee and in a marketing effort they give you unlimited points as a reward.  If you look around you will see most (probably 80-90%) are for 500 points.

Some experts ignore all questions not worth 500 points.  Others look for them knowing they will have fewer experts trying to get the answer.

To me it doesn't matter.  I don't even look at the points.

mlmcc
0

Commented:
I suspected you wouldn't be able to use the formula though I was hoping.

mlmcc
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.