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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count number of groups?

Status
Not open for further replies.

patti2

Technical User
Nov 7, 2003
8
US
Using CR 8.5, how can I count the number of groups? Group is by customer, group selection is count ({detail field}) > 1 and I want to know how many customers fit the criteria.

Thanks in advance.

 
The number of groups is easily determined with the following formula in your report footer:

Maximum(GroupNumber)


Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
Thanks, dgillz,
I knew there had to be a simple solution.
 
I don't think you can use the maximum function with groupnumber. Try going to insert->special field->groupnumber and placing groupnumber directly into the report footer. Since groupnumber is a running total of groups, it will ignore the non-group selected groups when counting.

-LB
 
Couldn't you just use a Distinct Count of whatever field you are grouping on...?
 
MJRBIM: Yep, and it would be available anywhere in the report.

distinctcount({table.field})

-k
 
Nope, because distinctcount will pick up the non-group selected groups.

-LB
 
LB: Good point, if the grouping isn't performed on the server it won't, and Crystal won't pass the distinctcount, but oddly still counts items which are excluded by the group selection.

I tend to always think in SQL terms, not Crystal Grouping.

-k
 
Thanks, all for your input. I find the exchange to be quite helpful. I get frustrated when what works in one software doesn't in the next. Unfortunately, I don't think my brand of multi-lingualism will help me on a world-wide vacation!

FYI, maximum(groupnumber) did not work, however lbass' solution of placing groupnumber in report footer did.

-p

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top