All eazyBI for Jira eazyBI for Confluence Private eazyBI

Median

Returns the median value of a numeric expression evaluated over a set.

Before you create the calculated measure with the median function, check if you can use standard functionality to add statistical calculations.

Syntax

Median(Set_Expression, Numeric_Expression)

Arguments

Set_ExpressionMDX expression that returns a set for which the median value will be calculated.

Numeric_Expression

MDX expression that returns a numeric value that should be used to calculate the median value.

Returns

Number

The median value of Numeric_expression over a set

Examples

Example 1

The following example calculates the median time in days for unresolved issues from the last status change till today.
The formula pulls in a set of unresolved issues. This set will look for unresolved relevant to report selections and calculate the median value for those issues from the last status update until now.

Median(
  Filter(
    Descendants([Issue].CurrentMember, [Issue].[Issue]),
    -- for unresolved issues only
    IsEmpty([Measures].[Issue resolution date]) AND
    -- show on time for issue creation date
    DateInPeriod(
      [Measures].[Issue created date],
      [Time].CurrentHierarchyMember)
    ),
    -- calculate days in current status for each relevant issue
    CASE WHEN
      -- check if issue is relevant for the report
      [Measures].[Issues created]  > 0 
    THEN
      -- calculated days in status
      DateDiffDays([Measures].[Issue status updated date], Now())  
    END
  )
)


Example 2

The following example calculates the median resolution days for resolved issues filtered by the report context.

Median(
Filter(
Descendants([Issue].CurrentMember, [Issue].[Issue]),
Not IsEmpty([Measures].[Issue resolution date])
),
[Measures].[Total resolution days]
)


Example 3

The following example calculates the median of the issue cycle in workdays for issues that went to the status Approved.

Median(
  Filter(
    Descendants([Issue].CurrentMember,[Issue].[Issue]),
    [Measures].[Issues CM Production cycles ended] > 0 AND
    (
      [Measures].[Transitions to status],
      [Transition Status].[Approved]
    )>0
    
  ),
  [Measures].[CM Production cycles workdays] / 
  [Measures].[Issues CM Production cycles ended]
)

See also