All eazyBI for Jira eazyBI for Confluence Private eazyBI

Key

Returns the Key of the selected member.

Syntax

Member_Expression.Key

Arguments

Member_Expression

MDX expression that returns a member.

Examples

Get Issue key

The following formula returns the Key of the current issue. If individual Issues are selected in Rows, then a measure with this formula will display the Key for each of them.

[Issue].CurrentHierarchyMember.Key

Hours spent by Assignee on assigned issues

If you create a report with Assignee members in Rows, you can use the Hours spent measure to show the hours logged toward the issues assigned to the users. This, however, will also show the hours logged by other users as well. The following formula will allow you to show hours logged by the user who has been assigned to the issue:

(
  [Measures].[Hours spent],
  [Logged by].[User].GetMemberByKey(
    [Assignee].CurrentHierarchyMember.Key
  )
)

This formula uses the Key function to get the Key of the Assignee user in Rows and then uses this Key to match with the same user in the Logged by dimension. This will allow you to show only the hours logged by this same user.

Optimize version to check by issue type using Key

The member key value can be accessed in two ways: directly using the function Key 

[Issue Type].CurrentHierarchyMember.Key

Or using the function GetString().

[Issue Type].CurrentHierarchyMember.GetString('KEY')

The second is a longer expression and is rarely used; however, it might be useful when optimizing complex calculated measures that filter by property value for large date cubes. Then you can use an expression that compares the identifier of the assigned issue type (issue property) with the Key of the specific dimension Issue Type member.

For example, the commonly used expression for checking if the issue type is "Feature," which is correct and better perceived by humans to understand what the code does:

[Measures].[Issue type] = "Feature"

Optimized expression to check by issue type "Feature" for complex calculations:

[Issue].CurrentHierarchyMember.GetString('Issue type ID') 
  = ConstantValue([Issue Type].[Feature].GetString('KEY'))

See also