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

Count or Distinct Count formula

Status
Not open for further replies.

BradCustom

IS-IT--Management
Oct 5, 2007
296
US
Hi all,

I'm writing a report using Crystal 2008 and I need some help with a Count/Distinct Count formula.
I'm trying to count all of the records that match the criteria below. There will be three different count formulas; one for each criteria.

Below are the three criterias:
Code:
if {@SchDayRem}<0 or
if (datediff ("d",{@CurrentDate},{Job_Operation.Sched_Start})) <0 and {Job_Operation.Status}in "S" or "O"

Second criteria:
Code:
if {@ProdDayRem}>0 and (datediff ("d",{@CurrentDate},{Job_Operation.Sched_End}))<({@ProdDayRem})

Third criteria would be to count all remaining records that don't meet the first two conditions.

The report has three Groups and three tables which are listed below:
G1 Department
G2 Work Center
G3 Scheduled Start Date

Tables:
T1 Job
T2 Job Operation
T3 Work Center

Thanks for your help and please let me know if you need more information.

Thanks!!
 
What have you tried? What problems are you encountering? You should be able to add criteria into the evaluation section of a running total using the formula option. Your formula is malformed though. First formula should be (my guess):

{@SchDayRem} < 0 or
(
datediff ("d",{@CurrentDate},{Job_Operation.Sched_Start}) < 0 and
{Job_Operation.Status} in ["S","O"]
)

Not sure which clauses belong together though.

-LB
 
Sorry for the previous post!!

It's been a LOOOOOONG week and my brain isn't working.

I was trying to write a formula using Count or Distinct Count; basicly making it far more complicated than it needs to be.

The running total approach that you've suggeted will work perfectly for all three conditions.

Sorry and thanks a lot for waking up my brain cells.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top