Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Count or DistinctCount?

Count or DistinctCount?

Count or DistinctCount?

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.

if (Sum ({@WCHoursWorkedLine}, {Work_Center.Work_Center}))=0
then 0
(Sum ({@WCHoursWorkedLine}, {Work_Center.Work_Center})/{@GrandTotWCCap})*100


Global numbervar newtotalvar;

DateDiff ('h',{Transaction_Data.Transaction_Start} ,{Transaction_Data.Transaction_End} )


Shared numbervar WCC;
Global numbervar newtotalvar;

newtotalvar:= newtotalvar + WCC;

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?

All of those variables and nested formulas make this confusing, but you should be able to write a formula like this (which uses a variable because you used one for the calculation) to be placed in the workcenter group footer:

Numbervar cnt;

If {@yourfinalvalue} > 0 and
{@yourfinalvalue}<=75 then
cnt := cnt + 1;

Then in the report footer, add a display formula:

Numbervar cnt;


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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close