Case workflow time calculation

We are trying to apportion the elapsed time in a workflow (HD or CRM) to the departments that do the work. I am having a devil of a time tying to make it work in a BAQ… assuming a BAQ is the right way to go. It may not be.

Assume the following (very basic)

Task A started and ended on Day 1 and was performed by Dept 1
Task B started and ended on Day 1 and was performed by Dept 1
Task C started on Day 1 and ended on Day 2 and was performed by Dept 2
Task D started on Day 2 and ended on Day 6 and was performed by Dept 3
Task E started on Day 6 and ended on Day 10 and was performed by Dept 1

So, the total days on which work was done is 10.

However if I add up the days by Dept, I get (and yes, I know I am double-counting)

Dept 1: A + B + E = 1 + 1 + 5 = 7
Dept 2: C = 2
Dept 3: D = 5

Total = 14

How do I handle a day that is split between multiple departments?

I would like to see:

Day 1: 3 tasks, so each gets .33 of a day
Day 2: 2 tasks, so each gets .50
Days 3-5: 1 task
Day 6: 2 tasks, so each gets .50
Days 7-10: 1 task

This should result in

Dept 1: A + B + E = .33 + .33 + .5 + 4 = 5.16
Dept 2: C = .33 + .5 = .83
Dept 3: D = .5 + 3 +.5 = 4

Now the total would be 5.16 + .83 + 4 = 9.99 (close enough)

Any ideas on how to tackle this? I

Thanks.