We are trying to perform a Utilization % calculation in DAX and I cannot figure out the forumula. Here's the setup:
Table images are here: http://imgh.us/dax.png
Table 1: There is a [timesheet] Table for our resources (R1, R2, R3, R4). Each timesheet record has a date and number of hours charged.
Table 2: There is a [resource] table with resource [hire date] and [termination date].
Table 3: There is a [calendar] table with available hours for each date. Weekdays have 8 h/day, weekends have 0 h/day
For any given filter context we need to calculate:
Utilization % = (hours charged) / (hours available)
This is not so hard, except for the fact that the (hours available) must only include dates between the [hire date] and [termination date] for each employee. Getting this to work at the aggregate level has been very difficult for us since the calculation must consider each individual employees date range.
The closest we have gotten is:
[hours available] := SUMX(DISTINCT(timesheet[resource_key]), SUM(calendar[utility_hours]))
[hours charged] := SUM(timesheet[bill_hours])
[Utilization %] := [hours charged] / [hours available]
However, this does not perform the resource hire/term date range filtering that is required.
Thanks for any help you can offer!