Creating a Time to First Comment date

Hi,

I’m trying to create a “Time to first Response” measure that show the time from issue creation to the time of the first comment. In order to do this, I am attempting to leverage the difference between the issue created date and a custom field I am importing.

The custom field is generated in Advanced Settings with:

[jira.customfield_firstcommentdate]
name = "First comment date"
data_type = "datetime"
javascript_code = '''
var comments = issue.fields.comment.comments;
if (comments.length > 0) {
  var comment = comments[0];
  issue.fields.customfield_firstcommentdate = comment.created;
}
'''

I then import the first comment date as a custom property.

In order to generate the “Time to First Response” measure, I use the following calculated measure:

NonZero(
  Avg(
    Descendants([Issue].CurrentMember, [Issue].[Issue]),
    DateDiffDays([Issue].CurrentMember.get('Created at'),
        [Issue].CurrentMember.get('First comment date'))
  )
)

However, whenever I add the Time to First Response measure to a table, it doesn’t display any values.

Does anyone know where I might be going wrong, or if there is an easier way to do this?

Thanks,
Sam

You are on the right track. The only thing missing there is a measure in MDX calculation. You can use default measure Issues created as a filter there or any other to filter issues based on any report context.

Here is the suggested update for the formula:

NonZero(Avg(
  Filter(
    Descendants([Issue].CurrentMember, [Issue].[Issue]),
    [Measures].[Issues created] > 0),
    DateDiffDays(
      [Issue].CurrentHierarchyMember.get('Created at'),
      [Issue].CurrentHierarchyMember.get('First comment date'))
))

However, the missing measure is not the problem here. Typically missing measures will give you more results than necessary.

If you are missing any results, please add Issues dimension to report and select a couple of issues you know there should be some results. Add property Issue First comment date. Check if there is any value in this property. If there is no values pease check if import worked as expected. Run full data re-import if necessary.

Please take into account, you have NonZero function in the formula. It will show you no results if there is far too small/no difference between the Creation time and First Comment time.

I double-checked both your codes and apart from missing measure they worked for me. Please check any spelling, we address issue properties using case sensitive field name match. I did not see any errors there, though.

In my example, I removed NonZero function from the formula, as I did not have values for most issues as first comment time was the same as issue creation time:

Please check if you do not have any default measure with the same name Time to first response. eazyBI should validate and not allow the creation of the measure with an already existing name. However, there are rare cases when we have seen this problem. Create a new measure with another name to avoid this.

Daina / support@eazybi.com

Hi,
It is possible to call out a person based on comment?
I want to add another column in the report “Issue First Commented by” and “Issue Last Commented by” if it is possible please help me to build the report for same.

Thanks.