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

Grouping by a Derived Date Formula 1

Status
Not open for further replies.

Bella6

Programmer
Jan 23, 2003
3
US
I am on Crystal 8.5, and trying to create a report which groups by the age of a record.

If the record is 36 months old, I would like to group the check dates (not distinct) by 3, 6, 9, 12...36 months. In order to do this it looks like I need to create some sort of formula which calculates the age of the record and then be able to group by that.

Can anyone help me?
 
Try something like:

if datediff("m",{table.field},currentdate) < 4 then
1
if datediff("m",{table.field},currentdate) < 7 then
2
if datediff("m",{table.field},currentdate) < 10 then
3
etc...

Make sure thaqt you have an open ended qualifier at thye end, such as:

if datediff("m",{table.field},currentdate) > 39 then
9999

You might also group by Quarters without using a formula if that suits your requirement, change the group options for the date to Quarter.

-k
 
Thanks so much - it looks like your suggestion is working!
SG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top