Count or DistinctCount?
Count or DistinctCount?
(OP)
Hi,
I'm using Crystal Reports 2011 with an SQL database.
I'm trying to count the number of Workcenters who's utilization is equal to or below 75%. There are 39 different Workcenters in the report and it's grouped by Workcenter and Transaction Start Date. The Utilization spans over a date range selected be the user. The Utilization is calculated using the following formulas.
@GrandTotWCUtil
if (Sum ({@WCHoursWorkedLine}, {Work_Center.Work_Center}))=0
then 0
else
(Sum ({@WCHoursWorkedLine}, {Work_Center.Work_Center})/{@GrandTotWCCap})*100
@GrandTotWCCap
whileprintingrecords;
Global numbervar newtotalvar;
@WCHoursWorkedLine
DateDiff ('h',{Transaction_Data.Transaction_Start} ,{Transaction_Data.Transaction_End} )
@RTotWCCap
whileprintingrecords;
Shared numbervar WCC;
Global numbervar newtotalvar;
newtotalvar:= newtotalvar + WCC;
@TotWCCap
shared numbervar WCC :=
if (Sum ({@WCHoursWorkedLine}, {Transaction_Data.Transaction_Start}))>10 and
({Transaction_Data.Employee}) in ["396","044","378","049"]
then 16
else 8
Let me know if anyone has any ideas how I can do this. Thanks for your help!!
I'm using Crystal Reports 2011 with an SQL database.
I'm trying to count the number of Workcenters who's utilization is equal to or below 75%. There are 39 different Workcenters in the report and it's grouped by Workcenter and Transaction Start Date. The Utilization spans over a date range selected be the user. The Utilization is calculated using the following formulas.
@GrandTotWCUtil
if (Sum ({@WCHoursWorkedLine}, {Work_Center.Work_Center}))=0
then 0
else
(Sum ({@WCHoursWorkedLine}, {Work_Center.Work_Center})/{@GrandTotWCCap})*100
@GrandTotWCCap
whileprintingrecords;
Global numbervar newtotalvar;
@WCHoursWorkedLine
DateDiff ('h',{Transaction_Data.Transaction_Start} ,{Transaction_Data.Transaction_End} )
@RTotWCCap
whileprintingrecords;
Shared numbervar WCC;
Global numbervar newtotalvar;
newtotalvar:= newtotalvar + WCC;
@TotWCCap
shared numbervar WCC :=
if (Sum ({@WCHoursWorkedLine}, {Transaction_Data.Transaction_Start}))>10 and
({Transaction_Data.Employee}) in ["396","044","378","049"]
then 16
else 8
Let me know if anyone has any ideas how I can do this. Thanks for your help!!
RE: Count or DistinctCount?
//{@meetscriterion:
Whileprintingrecords;
Numbervar cnt;
If {@yourfinalvalue} > 0 and
{@yourfinalvalue}<=75 then
cnt := cnt + 1;
Then in the report footer, add a display formula:
//{@displaycnt}:
Whileprintingrecords;
Numbervar cnt;
-LB
RE: Count or DistinctCount?
I tried your suggestion and it works fine. Thanks for your help!!
Sorry if the post was a little confusing, there are two running totals that I am showing. One for Hours Worked and the second is Hours Available. Then I compare them to determine the utilization. I thought it might help to show all of the formulas I was using.
Brad