Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Date Last7Days

Date Last7Days

Date Last7Days

How come when I schedule a report and I use the Last7Days and run it on a Monday at 8:00 AM I don't get the Last Monday's value.  Is there a better way, maybe formula that will allow me to grab items from Monday-Sunday every week.


RE: Date Last7Days


I think it's including the Monday you run the report on as one of the 7 days, Mon, Sun, Sat, Fri, Thur, Wens, Tues.

Try running your report late Sunday night.


RE: Date Last7Days

I tried to run the report sunday night and is still not including Sunday.  What else should I try  ,  I am about to change my prompt to just add the start date and end date.  This will not allow me to schedule it

thanks for any help


RE: Date Last7Days

Try this in your record selection:

{MyTable.MyDateFied} >= datadate-7

Last 7 days would not include the previous Monday, that's the previous 8 days.

If you don't want the current Monday included, then alter the selection criteria to:

{MyTable.MyDateFied} >= datadate-7
{MyTable.MyDateFied} <= datadate-1

Also, I believe that historical instances of SI will use the current date to determine last7 days, not the date that the report was ran.

The formula above will always work.



RE: Date Last7Days

I have a bit of a problem, the Date field is a number type,   1020523 = 5/23/02. I have formula  called
@DATE = WriterDate({DAGENT.UDAY})  to show 5/23/02 on the report.  Where should i put the conversion you suggested.


RE: Date Last7Days

If @date is a date type, then just use:

@DATE >= datadate-7
@DATE <= datadate-1

If not, convert it to a date using the date() function either in your @DATE formula, or on the fly in the record selection criteria.

To place the formula in the record selection criteria (select from the menu):

Report->Edit Selection Formula->Record



RE: Date Last7Days

Hi !

Here is another way to get the records from last weeks
monday to sunday.
(independent of which day in the present week you run the report).

Use this in your record selection formula:
Date({your datefield}) >= (CurrentDate) - DayOfWeek(CurrentDate) -5 and
Date({your datefield}) <= (CurrentDate) - DayOfWeek(CurrentDate) +1

And if you want to show the period in the page header
just use the ToText-function like this:

ToText(CurrentDate - DayOfWeek(CurrentDate) -5) + ' to ' +
ToText(CurrentDate - DayOfWeek(CurrentDate) +1)


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close