I am trying to calculate number of days for particular year based on calendar table that i have created.

For Example: I have 3 columns.  

Event, number of days and Date when this event started

```
Event       DaysLost
Injury       30              25/12/2016  
Injury       588            06/08/2012

```

Days in 2016 - 6  

Days in 2017 - 24

For the second case:

Days in 2012 - 146  

Days in 2013 - 365  

Days in 2014 - 77 

Now for above case there are only 6 days which need to be counted in 2016 and the rest of the days should automatically be counted in 2017. But i cannot figure out how to do it. 

In my output i would like to put years in one column and days lost for year in front of that particular year.

I have a calendar table and i want sum of days to populate for a particular year.

I tried calculating it by getting end date, by adding number of days to First start date and then if days were more that remaining days in that year. subtract remaining days from total days and remaining days should move to next year. But i cannot figure out how to keep adding days for next years if days extends for many years and list them after words.

Sept 4, 2017
Please see the excel solution below

[Excel solution of the problem](https://i.stack.imgur.com/qikaW.png)