×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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!
  • Students Click Here

*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

Jobs

SAP Universe filter needed for previous week. Based on a datetime object

SAP Universe filter needed for previous week. Based on a datetime object

SAP Universe filter needed for previous week. Based on a datetime object

(OP)
I am trying to create a previous week filter in the universe to use to schedule a weekly report. I have a datetime field and it's giving me issues.

PSSI3_DM.AGENTACTIVITYLOG.STATUSDATETIME

I thought I could just do something like this.

PSSI3_DM.AGENTACTIVITYLOG.STATUSDATETIME >= dateadd(wk, datediff(wk, 7, getdate()), 0)
and
PSSI3_DM.AGENTACTIVITYLOG.STATUSDATETIME <= dateadd(wk, datediff(wk, 7, getdate()), 6)

or even this....
PSSI3_DM.AGENTACTIVITYLOG.STATUSDATETIME BETWEEN dateadd(wk, datediff(wk, 7, getdate()), 0) AND dateadd(wk, datediff(wk, 7, getdate()), 6)

How do you account for the time?
Previous week would be 11/24/2013 12:00:00 AM to 11/30/2013 11:59:00 PM

RE: SAP Universe filter needed for previous week. Based on a datetime object

hi,

Quote:

Previous week would be 11/24/2013 12:00:00 AM to 11/30/2013 11:59:00 PM

Really? What happens to 11/30/2013 11:59:01 PM? You have a ONE MINUTE HOLE in your assumption!

Actually, the previous week is

CODE

where [WhateverDate] >= 11/24/2013 12:00:00 AM
  and [WhateverDate] <  12/01/2013 12:00:00 AM 

Which is IDENTICAL to

CODE

where [WhateverDate] >= 11/24/2013
  and [WhateverDate] <  12/01/2013 

But of course the date strings would need to be converted to date/tiem values using whatever SQL syntax is appropriate for your db.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: SAP Universe filter needed for previous week. Based on a datetime object

(OP)
Thanks!!! Good point and good catch.

Are there Any ideas or suggestions on where to start with the SQL syntax. To convert date/time? I've only worked with date objects in the past.

RE: SAP Universe filter needed for previous week. Based on a datetime object

What db?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

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