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

Last Full Month in Last Year

Status
Not open for further replies.

DudleyBoy

MIS
Dec 9, 2009
7
GB
Hi,

I was wondering if someone could help.

I need to have a formula that gives results for the last full month, but for last year. So if i were to run the report today 18th May 2010 it would return results for All April 2009.

Thanks All
 
datevar x := dateadd("yyyy",-1, currentdate});
{table.date} in dateadd("m",-1,x-day(x)+1) to x-day(x)

-LB
 
Hi,

I know I'm missing something basic with this:

datevar x := dateadd("yyyy",-1, currentdate});{table.date} in dateadd("m",-1,x-day(x)+1) to x-day(x)

but I keep gettin gthe error that the ")" is missing, where's it missing from?

Any Ideas?
 
Sorry--remove the accidental curly bracket after currentdate:

datevar x := dateadd("yyyy",-1, currentdate);
{table.date} in dateadd("m",-1,x-day(x)+1) to x-day(x)

You do have to substitute your actual date field for {table.date} of course.

-LB
 
Thanks.

I've removed the }, the date field is also substituted, it's now refering to this part and saying a date is needed

dateadd("yyyy",-1, currentdate);

Any thoughts?
 
Sometimes the dateadd function will require enclosing in date():

datevar x := date(dateadd("yyyy",-1, currentdate));
{table.date} in date(dateadd("m",-1,x-day(x)+1)) to x-day(x)

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top