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

Current Date vs. Same Date Last Month

Status
Not open for further replies.

DKirksgirl

Technical User
Feb 22, 2001
12
0
0
US
I am writing a report that shows totals for current date and I need totals for the same date last month. How would I write that formula and how would I handle leap year and if the number of days in current month doesn't equal the number of days in last month. If, for instance, if there was a 31st day in this month and last month only has 30, then I would want to display zero for SameDayLastMonth
 
Here's a start...

Create a formula called Day and add the following...

Day ({YourDateField})

Group on this formula

Create another group based on YourDateField

Insert summary on the field you want to total by
YourDateField

Your record select formula or SQL determines how many totals are displayed per day.
 
Which version of CR are you using? Version 8 has a dateadd function that should work.

DateAdd ("m", -1, {YourDateField})
 
For the behaviour of no matching day of the month, try to follow the convention of what DateAdd Does instead of defining your new convention.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top