Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: formula on date values in a group Post Reply Post New Topic
Author Message
afrogers
Newbie
Newbie


Joined: 05 Feb 2009
Online Status: Offline
Posts: 3
Quote afrogers Replybullet Topic: formula on date values in a group
    Posted: 17 Jan 2012 at 5:34am
I have a report which shows the start and end dates when users were members of an employment benefit, for some users there will be multiple entries, with the latest start date having no end date.  I need a formula which will flag those users who's latest start date is less than 52 weeks from when they previously left the scheme.  I think I'm going to have to use a sub-report but I'm a newbie to using arrays etc. Below is an example of a record in the report that meets the criteria:

User            Start Date    End Date

John Smith   22/05/11
                    22/09/10    20/04/11
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 18 Jan 2012 at 3:20am
well if you group by user and order by start date, you could do a simple datediff, like:
 
if datediff("w", {table.startDate}, Previous{table.endDate}) < 52 then
  //flag the record
else
  //don't flag
 
HTH
ps, I never remember which order to put the dates in the datediff.  I tend to print the results and if it is negative, I reverse the date fields
 
IP IP Logged
afrogers
Newbie
Newbie


Joined: 05 Feb 2009
Online Status: Offline
Posts: 3
Quote afrogers Replybullet Posted: 18 Jan 2012 at 4:30am
Many thanks, the previous function is the one I was after.
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.