Newbies Erik_Robinson Posted September 13, 2010 Newbies Posted September 13, 2010 Hi, any help would be appreciated with this. I have records of jobs i do for customers, I am trying to find a way to work out the average days between each job we do ( to predict when they will need us next). At present I have a list of jobs with dates i.e. 1/1/10 Purchased 500 gallons 7/1/10 Purchased 500 gallons 18/1/10 Purchased 600 Gallons etc... What I am after is something like: 1/1/10 Purchased 500 gallons 7/1/10 (6 Days) Purchased 500 gallons 18/1/10 ( 11 days) Purchased 600 Gallons The date used is the creation date of the job record. Many thanks for looking.
comment Posted September 13, 2010 Posted September 13, 2010 (edited) Well, if you want to work out the average days between jobs, I believe you could do this directly by: 18/1/10 - 1/1/10 = 17 days; 3 jobs - 1 = 2 intervals in-between jobs; 17 days / 2 intervals = 8.5 days on average. Or, in more general terms (pseudocode) Max ( Date ) - Min ( Date ) / ( Count ( Jobs ) - 1 ) Edited September 13, 2010 by Guest
Newbies Erik_Robinson Posted September 13, 2010 Author Newbies Posted September 13, 2010 Hi Thanks for that, but I need to know the days between each date so that I can see trends and patterns which occur during different seasons.
comment Posted September 13, 2010 Posted September 13, 2010 For that, you will need to define a self-join relationship of the Jobs table, such as: Jobs::Date > Jobs 2::Date with records on the Jobs 2 side of the relationship sorted by Date, descending. Then you can calculate the interval as = Date - Jobs 2::Date It would probably be better to lookup the previous date into a local field (using the same relationship) in order to speed things up.
Newbies Erik_Robinson Posted September 13, 2010 Author Newbies Posted September 13, 2010 Thanks very much Michael, that sorted it !
Recommended Posts
This topic is 5243 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now