first user assigned to issue

Hi

From issue history I need to get the first user to whom the issue was assigned.

Expected result as in the screenshot

Thank you)

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

Hi Martins,

I tried to use the same but can this be used to get the first Date set for the Due Date field rather than the current date

@gsunil.kumar
when using eazyBI for Jira Server or Datecanter, eazyBI won’t import the history for Due date field.
You can try a similar script (as above) for some of your own custom fields.
I believe this community post could be useful to find the initial date value:

Martins / eazyBI

Thanks Martins.

It helped.

Regards,
Sunil

Is there a way to create a calculated measure that shows the second assignee of a ticket?

@Taylor_Quinn

Try creating new calculated measure using this formula:

CASE 
  WHEN
    [Issue].CurrentHierarchyMember.level.name = "Issue"
    AND
    [Measures].[Transitions to assignee]>0
  THEN
    Generate(
      Head(
        Order(
          Filter(
            DescendantsSet([Assignee].CurrentMember,[Assignee].[User]),
            [Assignee].CurrentMember.name <> "(Unassigned)"
            AND
            (
              [Measures].[Transitions to assignee],
              [Time].CurrentHierarchy.DefaultMember
            )>0
          ),
          (
            [Measures].[Transition to first timestamp],
            [Transition Field].[Assignee],
            [Time].CurrentHierarchy.DefaultMember
          ),
          BASC
        ),
        2
      ).item(1),
      [Assignee].CurrentMember.name,
      Chr(10)
    )
END

Martins / eazyBI

Thank you @martins.vanags! This is exactly what I needed