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

Count in a group

Status
Not open for further replies.

Sahubba

Programmer
Mar 16, 2011
108
US
Hello,
I have 3 groups

G-1=Department
G-2=Pat
G-3=Order

On group one I need to display how many pats and orders are in that dep. I am running into an issue with the orders, it is counting the dups for the orders by pat. How can i have it where it only counts the distinct orders by pat?
I have tried
distinctCount ({@OrderName},{PAT}) and that only gave me the distinct count of the orders by department.

I tried
distinctCount ({@OrderName},{Department}) and it gave me the same results....I kind of figure it would.

Please let me know if you need more info.

Thanks



 
What are you counting? If you counted Order Numbers and used Distinct Count, that should be OK.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
I am counting how many orders a pat had by department.
there are some dups for the orders. And doing it by distinct count did not work.
 
It ought to work. Try checking the data - are they exactly alike? (Maybe do a test report that groups by order.)

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
This is not clear. Maybe you should show a mock sample of your data and also show what you would expect the counts be be based on that data.

A distinctcount at the department level will show the distinct count of orders ACROSS Pats, so that if orders appear in more than one Pat, they will be only counted once. Thus, this total would be less than the simple addition of distinctcounts of orders at the Pat level.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top