I am looking to calculate the minutes spent performing a task that is within a specific time window.
I have the two input parameters defining the time window @WindowStart and @WindowEnd and i have [Task Start] and [Task End] columns in my task table.
What would be the easiest way to calculate the time spent on a task that is within my time window? Tasks can easily begin or end after @WindowStart and @WindowEnd.
If what you want is to find the length of tasks are entirely contained in the window:
If instead you want to look at durations that have any overlap with the window, just flip the and to an or.