The results from the sample data set would look something like the following. The only time something interesting happens is when the oldest order is closed.
Date opened Date closed Date Maximum time open (days)
5/2/2013 5/10/2013 5/1/2013 0
5/7/2013 5/2/2013 0
5/3/2013 5/15/2013 5/3/2013 1 (number of days since 5/2)
5/11/2013 5/4/2013 2 (number of days since 5/2)
5/13/2013 5/16/2023 5/5/2013 3
5/11/2013 5/16/2013 5/6/2013 4
5/7/2013 5
5/8/2013 6
5/9/2013 7
5/10/2013 7 (5/2 order closed, number of days since 5/3)
5/11/2013 8
5/12/2013 9
5/13/2013 10
5/14/2013 11
5/15/2013 8 (5/3 order closed, number of days since 5/7)
5/16/2013 9
5/17/2013 10
5/18/2013 11
5/19/2013 12
Bookmarks