5

I am trying to figure out a formula to calculate the urgency of a set of arbitrary tasks, based on the number of days until a 'deadline' and the % completion of the task already completed.

So far I have a 'function' which gives the represents:

U = ((dd * 25) - (100 - cp))

Where: 
dd = Day difference from deadline to current date (in an integer value)
cp = current completion % (in an integer value - in increments of 5 currently)

This gives me a linear function, and the 25 in the function indicates a 25% per day progression of the task.

So that at any given date:

Where U <0 task is urgent
Where U =0 task is on schedule
Where U >0 task is ahead of schedule
(The actual display on if a task is on schedule (within a range) would be handled separately)

Is there any other methods to calculate the urgency of a task, from the difference of two dates and weighted by a variable? From current responses: Using the start date,end date and current date differences along with completion % to calculate urgency

Possibly using a non-linear function to increase U when cp >75% and decrease U when cp < 75%. Are there any advantages for linear vs non-linear functions?

This will be used in MySQL & javascript, as I'd like a way to display how on track a task is using the U value. So finding a method to correctly (more so than my current method) calculate the value for U is what I'm attempting to do.

Solution

The solution I went with (based on marked solution):

((((((end_date - now) / (end_date - start_date)) * 100) * (100 - cp)) * 10) * -1)

Minor Changes made

Using the rule of three as a start, multiplied by 10 just to increase the values & create a wider range without needing to factor for float values too much. Also multiplied by -1, this was so that completed tasks then give a negative number, while incomplete tasks show a higher number (makes sense: higher urgency of a task therefore a higher number) I may in future add to this, adding a velocity for a task as suggested & also taking into account for the number of people assigned to a given task. This function is only going to be used for a rough guide to show someone what tasks (in a given list) the might need to do first.

Also as I used this in MySQL the function needed to be wrapped in a IFNULL (due to existing data in my case)

IFNULL( *function* ,-200)

An initial arbitrary value of -200 if it was null value (as some tasks do not have an start/end date)

Thanks for the assistance & suggestions

rStyles
  • 111
  • 6
  • What progression steps are there? Just 0/25/50/100 or more? Btw with `99 - cp` you won't have "on schedule" for 2 days left and 50% progress, shouldn't it be `100 - cp`? – Simon Mar 19 '13 at 13:42
  • the progression steps for completion are in increments of 5 currently. Yeah, I was making minor changes while I wrote this Question, so will update – rStyles Mar 19 '13 at 14:26
  • Does the 25 mean that the task is expected to take 4 days? – Beta Mar 19 '13 at 14:35
  • 1
    I think you need an estimate of velocity or some assumption about it - just because I'm 50% of the way done with a task doesn't tell you if I am ahead of schedule or not; how much task completion / day am I accumulating? – Mikeb Mar 19 '13 at 14:40
  • 1
    If there was a value indicating the estimated time needed for a task (in days) it would be a simple rule of three: `estimated / 100 * (100 - done)` then check if the value is smaller, bigger or equal the days left. – Simon Mar 19 '13 at 14:53
  • Yeah, the 25% per day is only a rough guide. As it's more of a warning 4 days before a task is due and for the urgency to start to flip. It's something that could obviously be changed, for different purposes. The velocity of a task isn't needed (& changes to the completion is handled separately), as I intend to group the urgency figures into Green/Amber/Red notices, while using the numerical value to sort. so the closer a deadline approaches depending on the current completion the urgency will flip sooner & show higher in a task list. – rStyles Mar 19 '13 at 14:54
  • I do have a deadline set, along with a start date, I could use those to figureout the time needed for the task to be done. – rStyles Mar 19 '13 at 14:55
  • I don't know any kind way to say this: you're not good at math. Give this project to someone with math skills or you'll come up with a **bad** tool, and everyone whose work is subjected to it will curse your name. – Beta Mar 19 '13 at 15:41
  • I am well aware that this version isn't perfect, & why I thought I should ask the question. – rStyles Mar 19 '13 at 15:55

1 Answers1

2

Given that:

  • due is day difference from deadline to current date
  • estimated is the time needed for a task
  • done is the progress in percentage

This would be a simple rule of three:

var rest = estimated / 100 * (100 - done);

if(due < rest) {
    state = 'behind';
}
if(due == rest) {
    state = 'on';
}
if(due > rest) {
    state = 'ahead';
}

Note that possibly very few tasks would be "on schedule" because they'd have to match exactly, you could also check in ranges like rest < due + 0.5 && rest > due - 0.5 or so, imitating a non-linear prioritizing.

Simon
  • 7,182
  • 2
  • 26
  • 42
  • Using ± tolerance/weighting is a good way - otherwise items will only ever be on-schedule for a split-second! – nickhar Mar 19 '13 at 15:13
  • The intention is to group the results later within larger ranges, in order to show on schedule. – rStyles Mar 19 '13 at 15:21
  • What do you mean with "later"? – Simon Mar 19 '13 at 15:23
  • The function is run in a MySQL query (adding a column) and it's the function I'm most interested working out, and finding a value which describes how much the task is complete to the date the task is due. The result of the query & where it displayed is where the tasks urgency would be grouped into Ahead/On/Behind, not within the function. I added it to assist in describing the problem. – rStyles Mar 19 '13 at 15:31
  • The rule of three, does look like a better way. I'll have a look into it. – rStyles Mar 19 '13 at 15:37