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

Need formula for New Month Calculation 1

Status
Not open for further replies.

rico7937

IS-IT--Management
Feb 20, 2001
33
US
I'm currently using Crystal Reports 10 for all of our reporting and I've been using the statement LASTFULLMONTH for month end reports.

Now our month end has changed from 1 - 30 or 31 to 21 - 20 of the next month ( Ex. Jan 21 to Feb. 20 . Is there a way that I can code a statement in my report to pulls days 20 thru 21 of next month instead of having to update the report each month ?

Here is a sample of my current report:

{Ticket.TicketOpened} in lastfullmonth
and
{Ticket.TicketStatus} = "Resolved"

Any help would be greatly appreciated.
 
Consider that when you will be running it is critical Do you want it to figure out the 21st of last month to the 20th of the current month, or is this some sort of projection wherein you need the 21st of this month until the 20th of next month?

Anyway, what you need to do is derive the dates, so here's some theory, and if you have problems, post when the report is ran and for whether it's deriving the future or the past.

So here's how you get the 20th or 21st for last month, this month and next month, should cover you:

Last month:
dateserial(year(currentdate),month(currentdate)-1,20)
Current month:
cdate(year(currentdate),month(currentdate),20)
Next month:
dateserial(year(currentdate),month(currentdate)+1,20)

You can change the 20 to 21 to get the 21st.

So if we wanted last month to this month, we'd use:

(
{Ticket.TicketOpened} >=dateserial(year(currentdate),month(currentdate)-1,21)
and
{Ticket.TicketOpened} <=cdate(year(currentdate),month(currentdate),20)
)
and
{Ticket.TicketStatus} = "Resolved"

Have a good weekend.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top