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

Current Year and Last Year

Status
Not open for further replies.

aj3221

Technical User
May 14, 2008
79
US
I have a report that has a year field that I am pulling from our system. I want to pull the current year and one year ago (17 and 16). Every year I have to go in and add the current year and get rid of of date 2 years ago. For example, at the beginning of 2017, I had to go in and remove 15 (for 2015) and add 17 (for 2017). Is there a way to just have it look at the current year and then 1 year ago so I don't have to go in and add the current year and take out the oldest year?
 
Use a record selection formula like this:

{table.date} in date(year(currentdate)-1,1,1) to date(year(currentdate),12,31)

If instead you have a year field with two digits only, try this:

(
{table.year}=Right(totext(year(currentdate)-1,"0000"),2) or
{table.year}=right(totext(year(currentdate),"0000"),2)
)

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top