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

Summarizing on Distinct Counts? 2

Status
Not open for further replies.

Tobiet

Technical User
Apr 29, 2004
4
US
Hi!

(Crystal v10)

I am working on a productivity report and am having trouble in one area and could use some help! My report groupings are:

GH1: {Productivity.Resource_Type}
GH2: {Productivity.Name_Full}

I have summarized for each employee in GH2 the total days worked during the report period by using (Distinct Count of {Productivity.Date_Provided}). I need to use a distinct count since they each provide multiple services on a single day and therefore have multiple records for each day.

Resource Type: PT Distinct count of days
Employee 1 15
Employee 2 11
Employee 3 20

I now need to be able to summarize for GH1-Resource Type, the sum of the distinct count of days worked for each employee. I am not looking for the distinct count of days for GH1 as a whole, but rather the sum of all distinct counts of the employees within the grouping (i.e. 46). It appears Crystal won’t let me sum on an aggregate.

Is there a way to accomplish this?

Thanks.
 
You can use the three formula method:

//{@reset} to be placed in the Group 1 header:
whileprintingrecords;
numbervar sumdcnt := 0;

//{@accumsumdcnt} to be placed in the group 2 header or footer:
whileprintingrecords;
numbervar sumdcnt := sumdcnt + distinctcount({productivity.date},{productivity.name_full});

//{@display} to be placed in the group 1 footer;
whileprintingrecords;
numbervar sumdcnt;

-LB
 
You can also build a formula to combine days and employee in some way and do a distinct count of that.

What you are wanting for at the higher level is not a distinct count of days, but a distinct count of employee days, so use a formula and distinct count that.

Editor and Publisher of Crystal Clear
 
Worked like a charm...thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top