Calculating average MTTR across the fleet

Hi @nebo ,

Welcome to the eazyBI community.

The Avg function works on a set of entities. The eazyBI app might use various dimensions for calculating the average of its members.
Therefore, you need to specify or filter the set of members for which to calculate the average value. You might see the actual syntax of the Avg here - Avg.

The below MDX expression checks through the Issue dimension to identify the relevant Issues and then calculate the average.

Avg(
 Filter(
--generate the set of all issue level children for the current member of the Issue dimension
  DescendantsSet([Issue].CurrentHierarchyMember, [Issue].[Issue]),
--the filtering conditions
--condition - relevant issue type
    [Measures].[Issue type] = 'Incident'
    AND
--downtime start populated
    NOT IsEmpty([Issue].CurrentHierarchyMember.get('Start downtime'))
   AND
--downtime ended in relevant time period
    DateInPeriod([Issue].CurrentHierarchyMember.get('End downtime'),[Time].CurrentHierarchyMember)
 ),
--the actual figure for the average if relevant to context
  CASE WHEN
    ([Measures].[Issues created],
     [Time].CurrentHierarchy.DefaultMember)>0
  THEN
    DateDiffDays([Measures].[Issue Start downtime],[Measures].[Issue End downtime])
  END
)

However, if you have a high number of issues and a multitude of customers*tools, then it is better to define a new JavaScript calculated custom field ‘Downtime duration’ for the relevant issue type and import it as a measure.
You may find out more about JavaScript calculated customfields here - JavaScript calculated custom fields.
In that case, the calculation of the average might be even as simple as this.

CASE WHEN [Measures].[Issues with Downtime duration]>0
THEN
[Measures].[Downtime duration]/[Measures].[Issues with Downtime duration]
END

You might also read about a similar use case in the following community thread - Time between to actions.

Regards,
Oskars / support@eazyBI.com