'How to find the number of days worked without overlapping days
I'm trying to work out the total number of days a vehicle has been working in DAX, but have been unsuccessful so far. Below is my current table (Bold is not a column, it is showing what I hope to achieve)
JobNo VehicleID StartDate EndDate **DaysWorked**
1 1001 1/1/22 3/1/22 **3**
2 1001 3/1/22 5/1/22 **2**
3 1001 5/1/22 7/1/22 **2**
The total number of days worked here should be appearing as 7 (I've shown this in bold). If a Job starts on the same day that another one ends, it shouldn't count as another day of work.
Solution 1:[1]
If the only overlap is by start dates matching ending dates, have you tried making the formula to calculate the difference in days and substracting 1 when the start date is an end date of a row with the same vehicleID? This won't work properly if later you filter the table
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Gustavo Schneider |
