Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Dates Relative to Month Question Post Reply Post New Topic
Author Message
CarlK
Newbie
Newbie
Avatar

Joined: 28 Jul 2010
Location: United States
Online Status: Offline
Posts: 13
Quote CarlK Replybullet Topic: Dates Relative to Month Question
     Posted: 03 Sep 2010 at 4:36am
I am summing various things in different reports for a set of months relative to the present currently.  The only way I have found to forecast future months is by using dateadd in a range, but this doesn't give me specifics I want in some cases.
 
I would like to sum my values initially from the first of next month and before, then from the second of next month to the first of the following month, etc.
 
What I presently have looks like this, and I have another formula that sums this.
 
IF {*date table*} < (DateAdd ("m", 1, CurrentDate))  THEN {*quantity table*} ELSE 0
 
The next month, and all of the following ones look like this with varying numbers int he DateAdd.
 
IF {*date table*} = (DateAdd ("m", 1, CurrentDate)) to (DateAdd ("m", 2, CurrentDate))  THEN {*quantity table*} ELSE 0
 
Again, I want to use relative dates and not specific ones so this would not need updating and would always be a snapshot.  Any help would be greatly appreciated.
 
 
Thank you
IP IP Logged
CarlK
Newbie
Newbie
Avatar

Joined: 28 Jul 2010
Location: United States
Online Status: Offline
Posts: 13
Quote CarlK Replybullet Posted: 17 Sep 2010 at 7:36am
I found an error in my formulas that would select the data twice for the last day selected/first day of the next group of dates selected, however I still have no idea how I would put the relative dates in as I posted above and figured I'd refresh this once to see if anyone can help.... or tell me it can't be done.
 
Thank you
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Sep 2010 at 8:04am
IF {*date table*} <= dateserial(year(currentdate),month(currentdate)+1,1) THEN {*quantity table*} ELSE 0
 
The next month, and all of the following ones look like this with varying numbers int he DateAdd.
 
IF {*date table*} in dateserial(year(currentdate),month(currentdate)+1,2) to dateserial(year(currentdate),month(currentdate)+2,1) THEN {*quantity table*} ELSE 0
IP IP Logged
CarlK
Newbie
Newbie
Avatar

Joined: 28 Jul 2010
Location: United States
Online Status: Offline
Posts: 13
Quote CarlK Replybullet Posted: 20 Sep 2010 at 2:55am
Thank you very much, I've been working on that one for a while now.
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