Classifying a group and then count based on the classification

I have a report in which I used the details section to classify my group.  I classified the group based on some selection and sorting formulas.  I now want to know how many of each type of group that I have based on the classification that I determined.  I tried using three running formulas that evaluated only a certain value, but the running total counts the information in the details section so I end up with inflated numbers.

My data is set up like so:

Group Name     Group Classification based on detail
detail
detail
detail

So it looks like this with data

case_ID          Type A
A
B
B

Case_ID 2       Type B
B
C

Case_ID3      Type C
C

So my goal would be to have a total that tells me that I have one of each type of group.  My running totals though are giving me a total of 1 for group A, 1 for group C, but 3 for group B.

Can I do what I want to do here?  This has plagued me for sometime and I am at a complete mental block so I am open to any suggestions.  I just need to get rid of my inflated numbers and make sure that each case_id (i.e. each group) is only counted once.  The difference is about 200 records and it is really messing up my statistics.

Also I have an intermediate level of crystal experience so very explicit instructions in any suggestions would be most appreciated.
josslmpdAsked:
Who is Participating?
 
mlmccConnect With a Mentor Commented:
I added 3 formulas to the group header to count the types

WhilePrintingRecords;
Global NumberVar AssaultCount;
If {@Offense Code} = "Assault" then
    AssaultCount := AssaultCount + 1;
""

I then have display formulas
WhilePrintingRecords;
Global NumberVar AssaultCount;
"Assaults : " & CStr(AssaultCount,0)

There is also a DeclareCounters formula that should be in hte report header
WhilePrintingRecords;
Global NumberVar SexAssaultCount;
Global NumberVar AssaultCount;
Global NumberVar HomicideCount;
""

mlmcc
mlmcc
0
 
mlmccCommented:
Set the runninig total to evaluate on change of group

mlmcc
0
 
josslmpdAuthor Commented:
If I evaluate on change of group it just counts the groups and gives me a total count.  I do not get a breakdown by type.
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
mlmccCommented:
What field is the type?

I thought the CASEID was the group and the TYPE was what you wanted to count.

mlmcc
0
 
josslmpdAuthor Commented:
The type field is a formula that is displayed in the group header.  I do want to count TYPE.  IF I evaluate based on group is gives me a total count of the number of groups.  If I reset the count based on TYPE or group I don't get the correct information either.
0
 
GJParkerCommented:
I'm not following your description of the issue here,

how are you using the details to classify you groups ?
what groups do you have ?
what are you trying to count ?

It would be simpler to follow if you provided an example of the data and structure and what the expected outcome is
0
 
mlmccCommented:
Is the type the same for the entire group?
or is the type shown the type of the first record?

Have you tried a distinct count of the type formula?

mlmcc
0
 
josslmpdAuthor Commented:
Sorry for the poor description.  I am looking at crime data.  An incident may have multiple offenses associated with it, but I only want to count each incident once.  I also need to count it for the most serious crime.  All of the offenses for an incident are listed in the details.  I have a formula that classifys the individual offenses into a category (Homicide, Sex Crime, Assault, Other) and then a custom sort order that lists the offenses in order based on servity of crime.  The category formula is placed in the group header so that it only displays the most severe crime.

Incident 1     Homicide
Homicide
Assault

Incident 2    Rape
Rape
Burglary

Incident 3   Assault
Assault
Kidnapping
 
The running totals still counts the detail information, though, so it looks like six incidents occurred when there were really just 3.  I think my flaw is that the displayed information is not a "real field" it is really just displaying the first of the two records.  So it works for display but not for statistics.  I don't know how to make that field "real" enough for summary information.  I can always export the report to excel and do a count, but I was hoping to do it all in a single report with crystal and or SQL.

Hopefully this description is a little clearer and not worse.
0
 
mlmccCommented:
How do you have the running total setup.

It would seem you want to count/evaluate when the INCIDENT field/group changes

mlmcc
0
 
josslmpdAuthor Commented:
The INCIDENT field changes everytime though.  As I said, counting on that group just gives me a total count of incidents.
0
 
mlmccCommented:
What is the group?

For the above data you need 3?

Can you upload the report?
No data needed

mlmcc
0
 
josslmpdAuthor Commented:
The group is the incident ID.  If the formula was working correctly, for the above data I would have three total incidents, one of each type.
incidentbyoffense.rpt
0
 
mlmccCommented:
Try this one.  It evaluates on the change of the group.

Are you trying to get the number of each "subtype" also.  SO what you want is

Incidents - 3
Assault - 1
Homicide - 1
Sex Crime - 1
Burglary - 0
Kidnapping - 0

The ones with 0 may not show.

mlmcc
incidentbyoffense-1-.rpt
0
 
josslmpdAuthor Commented:
What you typed is what I want.  The proposed solution in the attached file doesn't give me that though.  I cannot evaluate based on change of group.  It gives me the total number of incidents, without out any breakdown.
0
 
mlmccCommented:
That is a different issue than the problem we were trying to solve.  It can't be solved with summaries or running totals since they cannot be controlled

See if this is what you want.

This method will work for small numbers of offense types.  If you need more offense types and they might vary then another method will be needed.

mlmcc
incidentbyoffense-1-.rpt
0
 
josslmpdAuthor Commented:
I must not have been clear in my original post.  My only issue from the very begining was to get the sub-types totals nothing else.  I didn't think that it could be solved with summaries or running totals, but I wanted to double check.  This report looks the same as the last one, how is it different?
0
 
mlmccCommented:
Attached the wrong one apparently

mlmcc
incidentbyoffense-1-.rpt
0
 
mlmccCommented:
Still wrong

mlmcc
incidentbyoffense-rev1.rpt
0
 
josslmpdAuthor Commented:
Yes!  Thank you.  Could you in general explain what you did?
0
 
josslmpdAuthor Commented:
thanks for all of the follow up!
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.

All Courses

From novice to tech pro — start learning today.