Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Last two months records Post Reply Post New Topic
Author Message
brown
Newbie
Newbie


Joined: 13 Feb 2013
Online Status: Offline
Posts: 10
Quote brown Replybullet Topic: Last two months records
     Posted: 13 Feb 2013 at 4:24pm
I'm trying to create a report where I pull data from the last two full months based on date criteria.
For instance if I run the report this month I want to see dates from Dec & Jan.

I know I can use Last Full Month for last month but what about the month before last?
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 13 Feb 2013 at 11:37pm
Hi

Try this :

{YourDatefield} in date( year(dateadd('m',-2,currentdate)),Month(dateadd('m',-2,currentdate)),01)
 to
currentdate - (day(currentdate))
Thanks,
Sastry
IP IP Logged
brown
Newbie
Newbie


Joined: 13 Feb 2013
Online Status: Offline
Posts: 10
Quote brown Replybullet Posted: 14 Feb 2013 at 3:39am
Hi Sastry, that worked perfectly,thank you! I was using something similar but was getting records from Feb also. I am setting this up as a monthly report so the last two months will change each month. Just couldn't figure it out.
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