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

Last Year To Date by Month

Status
Not open for further replies.

shricky

Programmer
Mar 6, 2007
17
US
I am using Cognos 8, what function do I use or query calculation do I write to return last years data for a particular month? For example, I am trying to compare this years sales this month (current month) to last year's sales, this month last year. Since this month is May, I want to see May/2007 data and May 2006 data.

Thanks for your help.

 
Based on today , 22 may:

Code:
_first_of_month(add_months(_add_years(current_date;-1)))

will yield 1-6-2006 00:00:00

Code:
_first_of_month(_add_years(current_date;-1))

will yield 1-5-2006 00:00:00

Any date/timestamp between these values will yield may 2006


Ties Blom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top