Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formula for @begin_date to be last year's date Post Reply Post New Topic
Author Message
dawnh44
Groupie
Groupie


Joined: 25 Sep 2011
Online Status: Offline
Posts: 79
Quote dawnh44 Replybullet Topic: Formula for @begin_date to be last year's date
     Posted: 18 Jun 2012 at 3:48am
Hello everyone,
 
I'm trying to create a formula that will have the @begin_date set to a year from now.  I would also like to create a formula that would have @end_date be last month's date.  I believe it may have something to do with the DateAdd function, but I just can't seem to get this.   So, the begin_date would be 2011-06-01 and the end date would be 2012-05-01.
 
Any ideas?  Smile
 
Thank you.


Edited by dawnh44 - 18 Jun 2012 at 3:50am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 18 Jun 2012 at 3:52am
dateadd("m", 11, {?begin date})
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Jun 2012 at 3:12am
assuming you are always keying from today, I would do it something like this
//last year
dateserial(year(currentdate)-1,month(currentdate),1)
//last month
dateserial(year(currentdate),month(currentdate)-1,1)
IP IP Logged
dawnh44
Groupie
Groupie


Joined: 25 Sep 2011
Online Status: Offline
Posts: 79
Quote dawnh44 Replybullet Posted: 20 Jun 2012 at 4:43am
Thank you so much.  This worked.  Smile
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