Solved

# How to sort crystal report by calculated group percentage

Posted on 2008-10-15
650 Views
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
0
Question by:LarryT2
• 3

LVL 100

Accepted Solution

mlmcc earned 125 total points
ID: 22726061
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 Comment

ID: 22734739
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

LVL 100

Expert Comment

ID: 22736425
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

LVL 100

Expert Comment

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

mlmcc
0

## Featured Post

### Suggested Solutions

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…