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

Need help with formula selecting previous business week.

Status
Not open for further replies.

stormtrooper

Programmer
Apr 2, 2001
266
CA
Hi. I have a report in which I want to select the transactions from the previous business week. The report will be able to be run any time and day of the week so I guess the formula has to compensate for that. The date field for the report we'll call auth_dt. I'm using CR7. So far, I only have a slight idea on how to start, but any help would be greatly appreciated. Thanks.
 
Try:

{Datefield} in LastFullWeek

This should work for you. LastFullWeek is from Sunday to Saturday. If you need a different week range you can use the minimum(), maximum() and dateadd() functions to get there. For example a monday to sunday week would be:

{datefield} in Dateadd("d",1,minimum(LastFullWeek)) to dateadd("d",1,maximum(LastFullWeek))

Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
Would LastFullWeek include data from Saturday and Sunday? Also just trying your second approach, an error message appears, "A number, currency amount, boolean or string is expected here."
 
The LastFullWeek in CR runs Sunday to Saturday.

If you want the last work week (5 days) calculated based on today's date try:

{Orders.Order Date} in
CurrentDate - DayofWeek(CurrentDate) - 5
to CurrentDate - DayofWeek(CurrentDate) - 1
If you want it based on a field in the database, instead of today's date, replace CurrentDate with your field name. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top