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

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

Status
Not open for further replies.

careymw

IS-IT--Management
Oct 8, 2010
41
US
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
 
hi,

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,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
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.
 
What db?

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top