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

How to get only last 12 months data

Status
Not open for further replies.

Reghita

Programmer
Sep 9, 2002
16
AU
I got a report that calculates the total number of calls received for each months using cross tab format.

But I only need to get the last 12 months data from last month. Does anyone know how can I do this?


RB
 
Do you mean every date between the last day of last month and first day of a month 12 months before that? If so, you could get the start of the current month, First_This, as:
datetime (datepart("yyyy", CurrentDate),
datepart("m", CurrentDate), 1)
Then get Last_Month, the last day of last month:
DateAdd ("d", -1, First_This)
Then get Last_Year
DateAdd ("yyyy", -1, First_This)

Select dates that are between Last_Year and Last_Month, inclusive.

Madawc Williams
East Anglia, Great Britain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top