Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy Crosstab Formula --- Date >=Past 6 months 2

Status
Not open for further replies.

rhoneyfi

MIS
Apr 8, 2002
200
US
Hello, I am uing Crystal 9.0 . I have developed a crosstab report. The columns are grouped by month. What I would like is for the report to show just the past 6 months worth of data. If there was a perfect world, the formula would be : Date >= Last6Months. Since this doesn't exist, does anyone have a formula I could use? I don't want to use a date parameter. I just want it so when a user runs the report (whether it be today, or 5 years in the future), it just shows data for the last six months. Thanks!!
 
{DateField} in CurrentDate to Dateadd("m",-6,CurrentDate)

The above will return everything in the last 6 months. Is this what you want?

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
Actually, I need a slighly different formula. I need a date formula sntax that says "show me all of the records for the entire last six months". So if I was to run it today, it would show all the records for Nov 2004, Oct 2004, Sept 2004, Aug 2004, July 2004, June 2004. The formula posted above almost does this ... but (in this case) it show records from July 17 - Nov 17th....I need July 1 to Nov 17th. Thanks for any help!
 
Try:

{DateField} in Dateadd("m",-6,CurrentDate-day(currentdate)+1) to currentdate

-LB

 
I use the following on my reports. I use the DateSerial function which automatically adusts for the year changes
Code:
{TABLE.DATEFIELD} in [dateserial(year(currentdate),month(currentdate) - 6,1) 
to_ dateserial(year(currentdate),month(currentdate),1)]

Cheers,

-LW
 
Thanks lbass and wichitakid..both formulas work great.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top