first user assigned to issue

Hi,

There are two ways how to calculate the first assignee:

  1. MDX way by creating a new calculated measure:

code:

 CASE WHEN 
[Issue].CurrentHierarchyMember.Level.Name = "Issue"
THEN
    [Assignee].[User].GetMemberbykey(
          Order(
          Filter(
          Descendants([Assignee].CurrentHierarchyMember,[Assignee].[User]),
          [Assignee].CurrentMember.Name <> "(unassigned)"
          AND
          (
          [Transition field].[Assignee],
          [Measures].[Transitions from],
          [Time].CurrentHierarchy.DefaultMember
          )>0
          ),
          ([Measures].[Transition to first timestamp],[Transition Field].[Assignee]),
          BASC
          ).item(0).key
        ).Name
END

This approach would calculate the first assignee for an issue.

  1. use Javascript in eazyBI [advanced settings] (https://docs.eazybi.com/display/EAZYBIJIRA/Advanced+settings+for+custom+fields) when defining a new calculated custom field to calculate the first assignee from the changelog and then import results as new property for Issue dimension members

code:

[jira.customfield_firstassignee]
name = "First assignee"
data_type = "string"
javascript_code = '''
var assignee_dname;
if (issue.changelog && issue.changelog.histories && issue.changelog.histories.length > 0) {
var histories = issue.changelog.histories;
for (var i = 0; i < histories.length; i++) {
var history = histories[i];
if (history.items && history.items.length > 0) {
for (var n = 0; n < history.items.length; n++) {
var item = history.items[n];
if (item.field == 'assignee' && item.toString) {
assignee_dname = item.toString;
}
}
}
if(assignee_dname){
break;
}
}
}
issue.fields.customfield_firstassignee = assignee_dname;
'''

In some specific scenarios (assignee is set during creation) both approaches may return different results for an issue.

Martins / eazyBI support