title: Sum duration of time by group and only sum overlap if group members>1
body: <p>I have a problem of coming up with a DAX measure to sum up unavailable time due to maintenance per unit and per site.
  My dataset has unit identifiers, site identifiers, start and end of maintenance timestamp (date time format). Most sites have one unit but some can have 2 or 3 or more.</p>
  <p>I need to calculate amount of time each unit and each site was unavailable due to maintenance.</p>
  <p>With units is straightforward: Unavailable time per unit equals the sum of the differences of all end timestamps and start timestamps per unit.
  With sites I have a problem. Simple sum is not the right answer because if at least one unit at the site is not under maintenance the site is okay.</p>
  <p>If site has one unit - if its maintained - that site is unavailable. If site has 2 or 3 or more units, it is unavailable only for the time where all the units on the site are maintained in the same time.</p>
  <p>So I need help coming up with a query that will sum up duration of maintenance times per site if there is one unit on the site and sum up only overlapping duration when all units are maintained if there is multiple units on site.</p>
  <p>Is that is even possible could you please point me towards the solution. Ive been playing with this for hours now. Any help is appreciated.</p>