Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Date formula for last year Post Reply Post New Topic
Author Message
trac
Newbie
Newbie


Joined: 25 Apr 2012
Online Status: Offline
Posts: 13
Quote trac Replybullet Topic: Date formula for last year
     Posted: 06 May 2013 at 11:40am
I wish to have data of last 5 months of last year.
i.e. if it is 2012, Aug2011-Dec2011.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 May 2013 at 12:01pm
lots of ways to do this, here is one way:
month(datefield)>7 and year(datefield)=year(currentdate)-1
IP IP Logged
joeg1962
Newbie
Newbie


Joined: 01 Mar 2013
Location: United States
Online Status: Offline
Posts: 35
Quote joeg1962 Replybullet Posted: 07 May 2013 at 4:37am
You did not give much information, but the following should get your mind started along the correct path.

//set two variables
date1=date(year(currentdate)-1,8,1)
date2=date(year(currentdate)-1,12,31)
//need to select
transactiondate>=date1 and transactiondate<=date2



IP IP Logged
trac
Newbie
Newbie


Joined: 25 Apr 2012
Online Status: Offline
Posts: 13
Quote trac Replybullet Posted: 07 May 2013 at 5:12am
Thanks this worked
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