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!

Last7Days function

Status
Not open for further replies.

Crystalguru

Technical User
Oct 4, 2001
303
US
I am trying to find a function similiar to the last7days but a Last12months.

What I am looking for is all the requests made in the last 12 months, like a rolling 7 days.

If I ran it today 1/9/03 it would return all request dated 3/2002 to 1/03.

thanks
 
{DateField} in CurrentDate to Dateadd("y",-1,CurrentDate)

Sould return every thing from today to one year ago.

I did not understand your statement:
"If I ran it today 1/9/03 it would return all request dated 3/2002 to 1/03." Software Sales, Training and Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
To explain the part "If I ran it today 1/9/03 it would return all request dated 3/2002 to 1/03." -- the report would only return request dates that are 12 months back from the current date.

The formula looks like what I want. But when I used it, no data is returned. I tried using the "m",-1 to just return last months data, still no data.

any ideas?
 
I had to modify the formula a bit.

{ILT_Leads.RequestSubmitted} in Dateadd("yyyy",-1,CurrentDate) to currentdate

Gives last year's date first then today's date.

Also, the Year value needed to be yyyy

Thanks for putting me on the right track. It's nice to have that boost and then figure out the rest myself! I learn from it!

thanks again
 
"all request dated 3/2002 to 1/03."

Does that mean March 2002 to January 2003? If not what does it mean? Thats what I dont understand, this is not a 12 month time frame.

I am glad you got the report working Software Sales, Training and Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
Yes, March 2002 to January 2003. Because 1/9/2003 is the current date and if you go back 12 months, you come up with March 2002. It is a rolling 12 months....depending on the currentdate.

later
 
CrystalGuru,

Doesn't a 12 month period usually have a February in it somewhere? I am pretty sure that March to January would only be 11 months. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Ok, it was a long day and the manager wanted the report yesterday. Yes, 12 month span DOES include Febuary...thanks for pointing that out Ken. It would be current date (january 2003) to back 12 months (Febuary 2002).

thanks
 
Hi, This is my first question. I need to do what first gal did, but I need to go back 21 days. I tried a variation of the 'year' suggestion that was provided:
Incident.Date_Incident} in Dateadd ("dd",-21,CurrentDate) to currentdate
but am getting the following error: Argument #1 of Dateadd is out of range.

I am SOOOO new at this, but really need to create this report for our Police Department.
Thanks for any help.
 
Hi Chaebe,

That was a pretty good stab, and you're nearly there, but you don't want 'dd' to specify days. It's just 'd'.

{Incident.Date_Incident} in Dateadd ("d",-21,CurrentDate) to Currentdate

Good luck with your report,

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top