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!

Month formula

Status
Not open for further replies.

natetc

Technical User
Nov 4, 2010
21
CA
Hi,

Just looking for a simple month formula that will filter all data from the quarter. (ie last quarter from today Oct 16- Dec 16)

{TABLE.KEY_DATE}=currentmonth -3

Hopefully there is a easy solution for this, thanks!
 
Try:

{TABLE.KEY_DATE} in dateadd('m',-4,currentdate) to currentdate
 
Is this calendar quarter (e.g., Jan-Mar, Apr-Jun, Jul-Sep, Oct-Dec), or in the last three months?

If it's calendar quarter, use the DatePart function - datepart('q', {table.datefield}) will get you the calendar quarter of a date field.

If it's "in the last three months", try this:

{table.datefield} >= dateadd("m", -3, currentdate)

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Hi,

Sorry for bringing this back up from the dead.

Was looking for a formula that pulls data from the month before. The other posts here do not work, I've been trying to change this to make it work. Please let me know where I went wrong.

{TABLE.KEY_DATE}=currentmonth -1
 
i think this is more what you are looking for....but don't have crystal in front of me, so apologies if i am way off...caffeine wearing off as i type.

month({TABLE.KEY_DATE})= month(currentdate)-1
 
That did not work.

Is it something as easy as changing 'currentdate' to 'currentmonth' or am i way off line?
 
what didn't work about it?
error message?

have you tried 'lastfullmonth'?
 
Thanks for your help, that worked out perfectly!
 
Well, it won't work if the month is January, since month(currentdate)-1 would equal zero. It would be better to use:

{tabledate} in dateserial(year(currentdate),month(currentdate)-1,1) to dateserial(year(currentdate),month(currentdate),1)-1

Or better yet, use:

{table.date} in lastfullmonth

Both of these would take into account the year as well.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top