Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Totals / SubTotals

Status
Not open for further replies.

PamRutledge

Programmer
Oct 12, 2006
6
US
I have to create a report that lists all student classes and grades:

Susie Smith English 12 87
Susie Smith Social Studies 12 62

Then I need to come up with how many classes Susie failed. I have that part working.
BUT I have to at the end of the grade level show the total enrollment (which I have working) the # of students who failed 1 class and the percentage, # of students who failed 2 classes w/ percentage, etc.

So is should look something like:

Grade Enrolled 1 Class 2 Classes 3 Classes 4 Classes
7th 100 2-2% 5-5% 16-16% 0-0%
8th
9th

Etc. I am not having ANY success creating these totals in the grade level footer. Any suggestions?
 
Create Running totals for failures

RTClass1Fail
Set to count Student ID

In the evaluate section select formula

enter conditions eg

Fail = true and class = 1
Set reset to never

Repeat for each class

YOu can then use these RTs in a report footer formula to
calc % based enrolments

eg @Class1Fail

RTclass1Fail % sum(studentID)

Ian
 
No luck - I am beginning to HATE Crystal! LOL!

Student #1 failed English so she failed 1 class
Student #2 failed English and SS so she failed 2 classes
Student #3 failed Eng, SS, & Sci so she failed 3 classes
Student #4 failed PE, so that's 1 class
Which summarizes to 2 students failed 1 class, 1 student failed 2 classes, and 1 student failed 3 classes.

Enrolled # Failed 1 Failed 2 Failed 3 Failed 4
100 2 1 1 0

No matter how I try it the running total reset for each student - even if I do a manual RT. Only been using Crystal for 6 months and only on very simple reports until now.
 
Sorry Misunderstood.

Group Report by Student

In Group footer

whileprintingrecords;

Global number var Fail1;
Global number var Fail2;
Global number var Fail3;
Global number var Fail4

If count(class, student) = 1 then Fail1:=Fail1+1;
If count(class, student) = 2 then Fail2:=Fail2+1;
If count(class, student) = 3 then Fail3:=Fail3+1;
If count(class, student) = 4 then Fail4:=Fail4+1;

In Group Footer create four new formula like

@DisplayFail1
whileprintingrecords;

Global number var Fail1;


YOu can also use var to calculate %age in another set of 4 formula.


Ian
 
I would just create a formula {@fail}:

if {table.grade} = "Fail" then 1

Then use a running total {@2failed} that does a distinctcount of studentID, evaluate using a formula:

sum({@fail},{table.studentID}) = 2 //two classes failed

Reset on change of group: grade level. Create a separate running total for each potential number of classes failed.

For the percentages, you can use the following in the gradelevel group footer:

{#2failed}%distinctcount({studentID},{table.gradelevel})

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top