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

Counting & COmparing records within a date range 1

Status
Not open for further replies.

dhshaikh

Technical User
Jun 19, 2003
9
GB
Hi,

I have a number of records that are entered on various days. I would like to count the number of records per month and then be able to compare the number of records between two months.

I cannot use a crosstab since it is limited in allowing me to compare between two months.

I feel I require a formula using an if statement and counting within a date range. I am new to crystal and would appreciate any help you can offer!

Example. if there are 2 records for 01/01/03, 1 for 05/01/03, and 1 for 10/02/03. the i would like to display 3 for january, 1 for february, and thus show a decrease of two in feb compared to jan!

Thank you
 
Write a few formulae:

@JanTest
If Month({DateField})=1 the 1 else 0

@FebTest
If Month({DateField})=2 the 1 else 0

Summarize these 2 fields.

Sum({@FebTest})-Sum({@JanTest}) should return if Feb went up or down.

You can write very similar formulas based on a date relative to todays date or to a parameter date using the dateadd() function.

Hope that helps.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top