R
Rebecca
Greetings this almost New Year's Eve,
I have a set of data with open and close dates (for one person). I want to
calculate the duration the person was open. But I can't do [close] - [open]
because some of the closures are errors--you can identify an error if the
next open date is the next month. For example, 5/16/2000 closures is an
error--because reopened 6/27/2000. So really, I want to subtract 1/1/2000
date from final closure of that period--which is 4/25/02
Open Close
2/15/1990 4/20/1992
8/1/1995 11/12/1995
1/1/2000 5/16/2000
6/27/2000 12/7/2001
1/4/2002 4/25/2002
3/14/2004 10/17/2004
6/4/2005 11/30/2005
Any thoughts on how to do this?
Here's what I've tried:
1) labeling closures as "bad" or "good" -- if "open date - 30 days < closure
date", then label closure date as "bad". Then I have an array--
5/16/2000 good
5/16/2000 good
5/16/2000 bad ---showing the one time where it closed & reopened
5/16/2000 good
and I'd need to then do a query eliminating a date that has _any_ "bad"
labels (I just submitted a question about this, since my HAVING clause isn't
working properly)
and final step -- subtract open date from smallest close date that is "good".
Any thoughts on a faster/better way to do this? (such as saying "if there's
_any_ open date that's up to 30 days > than the close date, then don't use
that close date in the time duration calculation.
Thank you.
I have a set of data with open and close dates (for one person). I want to
calculate the duration the person was open. But I can't do [close] - [open]
because some of the closures are errors--you can identify an error if the
next open date is the next month. For example, 5/16/2000 closures is an
error--because reopened 6/27/2000. So really, I want to subtract 1/1/2000
date from final closure of that period--which is 4/25/02
Open Close
2/15/1990 4/20/1992
8/1/1995 11/12/1995
1/1/2000 5/16/2000
6/27/2000 12/7/2001
1/4/2002 4/25/2002
3/14/2004 10/17/2004
6/4/2005 11/30/2005
Any thoughts on how to do this?
Here's what I've tried:
1) labeling closures as "bad" or "good" -- if "open date - 30 days < closure
date", then label closure date as "bad". Then I have an array--
5/16/2000 good
5/16/2000 good
5/16/2000 bad ---showing the one time where it closed & reopened
5/16/2000 good
and I'd need to then do a query eliminating a date that has _any_ "bad"
labels (I just submitted a question about this, since my HAVING clause isn't
working properly)
and final step -- subtract open date from smallest close date that is "good".
Any thoughts on a faster/better way to do this? (such as saying "if there's
_any_ open date that's up to 30 days > than the close date, then don't use
that close date in the time duration calculation.
Thank you.