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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dates from Last Year 1

Status
Not open for further replies.

jonbarr

MIS
Jun 20, 2003
66
NZ
I want to show transactions that occured in a set time frame last year with a start date of exactly a year ago, and a parameter of a number of days up to 180 after that date. I imagine the formula would look something like
Currentdate - one year + (number of days from parameter)

Can anyone please help with such a formula
Thank you
 
You can get creative with some of the built-in date range functions. For example:

Maximum(LastYearToDate)

... will give you today's date minus one year. If you have a parameter field like {?NumDays}, to get your desired result would look like:

Maximum(LastYearToDate) + {?NumDays}

-dave
 
Try:

{table.date} in dateadd("yyyy",-1,currentdate) to
dateadd("d",{?NoDays},dateadd("yyyy",-1,currentdate))

-LB
 
Thanks for your suggestion lbass.

I found Dave's idea worked well except the correct syntax in Ver 8.0 turned out to be "maximum (LastYearYTD)
 
jonbarr:
I think that was just a case of the brain not working with the hands on my part.

LB's formula would also work, but I can never remember if there are issues with pass-through when using Date functions (like DateAdd), so I find myself avoiding them in record selection formulas.

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top