I think I have two calculated fields that might help for now. I’ll need to do more looking to complete the process, but maybe this can help.
date_diff_weeks from shifts = dateDiff(lag({Shift Start Date},[{Shift Start Date} ASC],1,[{Agency Worker}]),firstValue({Shift Start Date},[{Shift Start Date} ASC],[{Agency Worker},{Shift Start Date}]),‘WK’)
That will get you the amount of time from each shift.
total_time_worked = dateDiff(firstValue({Shift Start Date},[{Shift Start Date} ASC],[{Agency Worker}]),lastValue({Shift Start Date},[{Shift Start Date} ASC],[{Agency Worker}]),‘DD’)
This will get you the total time worked without taking into consideration of the 6 week break period.
Now, we need to combine them together. So that you can partition by the “New Shifts”
partition_field_not_complete = ifelse(dateDiff(lag({Shift Start Date},[{Shift Start Date} ASC],1,[{Agency Worker}]),firstValue({Shift Start Date},[{Shift Start Date} ASC],[{Agency Worker},{Shift Start Date}]),‘WK’)>6,6,NULL)
This is what I have now. I need to figure out how to relay any date from these next 6 weeks to be the new shift.
However, once I get that then you should be able to complete it with this calculated field.
final_not_complete = dateDiff(firstValue({Shift Start Date},[{Shift Start Date} ASC],[{Agency Worker},{partition by 6 weeks}]),lastValue({Shift Start Date},[{Shift Start Date} ASC],[{Agency Worker},{partition by 6 weeks}]),‘DD’)
Wanted to give an update and hopefully this can help for now / see if anyone else can finalize it.