Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Date Ranges Post Reply Post New Topic
Author Message
sony
Newbie
Newbie


Joined: 04 Mar 2008
Location: United States
Online Status: Offline
Posts: 1
Quote sony Replybullet Topic: Date Ranges
     Posted: 04 Mar 2008 at 3:35pm
Hello,
 
I am new to Crystal REport writing in CR 2008. I need to write a formula that will do a count based on Date Range.
 
COUNT(empid)
where
Hire_date between 'first day of last month' and 'last day of lastmonth' and
Term_date is NULL
 
How can I do this? Any assistance is greatly appreciated.
 
Thans
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 05 Mar 2008 at 1:25am
Hi,
 
Create the formulas below
 
Firstday of Last Month (Fday)
 
 
minimum(Lastfullmonth)
 
Last Day of Last Month (Lday)
 
maximum(Lastfullmonth)
 
CountofEmp
 
if {Table.FieldName} in [{@Fday} to {@Lday}] and isnull(Term_Date)then
count({Employee ID},{Employee ID})
 
remeber to group on EmployeeID field else you will get count of all the records .
 
Cheers
Rahul
 
IP IP Logged
rusty
Newbie
Newbie
Avatar

Joined: 07 Mar 2008
Location: United States
Online Status: Offline
Posts: 16
Quote rusty Replybullet Posted: 07 Mar 2008 at 3:44pm

Thanks Rahul! I tried what you suggested; but it is asking me to create an Array! Thisis what I have so far.

If ({EmpComp.EecDateOfOriginalHire} >= {@First Day of Last Month})
 and ({EmpComp.EecDateOfOriginalHire} <= {@Last Day of Last Month}) and
isnull({EmpComp.EecDateOfTermination}) then
Count ({EmpPers.EepEEID})

Thaks

IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum