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

How to total by groups 1

Status
Not open for further replies.

CRilliterate

Technical User
Dec 7, 2005
467
US
Another SUB or Group question.

ID Code Prod

111 1001 AAA
111 1002 AAA

222 2002 BBB

333 3001 CCC
333 3002 CCC
333 3003 CCC

At the end I need Count of Codes

Total Prod for 111 - 2
Total Prod for 222 - 1
Total Prod for 333 - 3

Do I have to create SUB or not?



________________________________________
I am using Windows XP, Crystal Reports 9.0 with SQL Server
 
Try Insert > Crosstab. It should give you counts, though probably not with the text you showed.

If the text is a user requirement, you could do a manual crosstab with running totals for each possible ID. Or else a subreport, depending on whether it's more important to save coding time or machine processing time.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Do you mean I have to insert crosstab Report?

________________________________________
I am using Windows XP, Crystal Reports 9.0 with SQL Server
 
Group it by ID - insert summary for that group and do count on that summary on Prod.
 
Thanks, Madawc, worked like a charm!

Barock, I will try your solution now. Thanks

________________________________________
I am using Windows XP, Crystal Reports 9.0 with SQL Server
 
I do not have working environment as other people. My users are allowed to change their minds every 5 sec and now it is:

Code Prod Desc

1001 AAA qqq
1001 AAA www
1001 AAA eee

expected result is

Code Prod Desc

1001 AAA qqq
www
eee
Total Prod Count: 1

So combination of Code and Prod gives me 1.
I need to calculate unique occurences of Prod and Code and
Count Prods.

Thank you

________________________________________
I am using Windows XP, Crystal Reports 9.0 with SQL Server
 
Researched furter...I am affraid I need to loop and if combination Code and Prod >1 - do not count it, move on.
Will that be Do while loop?
And how do I indicate {combination Code and Prod}?

Thanks

________________________________________
I am using Windows XP, Crystal Reports 9.0 with SQL Server
 
I think I am confusing everyone.
Data can be

Code Prod
1001 AAA
1001 AAA
1001 AAA
Total: 1
2002 AAA
Total: 1

3003 AAA
3003 AAA
Total: 1

GrTotal Prod: 3

I am trying...so far it is giving me total 3,1,2 = 6

________________________________________
I am using Windows XP, Crystal Reports 9.0 with SQL Server
 
Try Distinct Count.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thanks

________________________________________
I am using Windows XP, Crystal Reports 9.0 with SQL Server
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top