How to customize "age interval"

Hello, it’s my 1st day in EaszBi and I am playing around with default report “Unresolved issues by age interval and priority”

It shows age intervals using (I assume) CreateDate as a time reference.

How can get age intervals using a custom date as I reference? I would like to see issue due by age interval since issues were 1st picked up and moved to status IN PROGRESS

Thanks

David

Hi @David_Mattatia

Welcome to the Community! :slight_smile:

This may be a bit complex if you are just starting out but bear with me, as this solution will perform faster than custom calculated measures.

It is not possible to change the age calculation of an existing Age interval, but you can define a new Age interval dimension with whichever reference date you want.

To do this, you need access to Advanced settings (available for Jira and eazyBI admins) and your report accounts Jira import options (located under the Source Data tab → Edit).

Add the following lines of code to your Advanced settings:

#Days in Development interval (unresolved)- days since In progress
[jira.customfield_developmentdays]
name = "Days in Development interval"
data_type = "decimal"
dimension = true
javascript_code = '''
var inProgressDate;
var progressStarted = false;
if(!issue.fields.resolutiondate && issue.changelog.histories) {
  for (var i=0; i < issue.changelog.histories.length; i++){
    issue.changelog.histories[i].items.forEach(function(item){
      if (item.field == "status" && item.toString == "In Progress"){
        issue.fields.customfield_developmentdays = Math.floor(Date.parse(issue.changelog.histories[i].created) / 1000);
        progressStarted = true;
      };
    });
    if (progressStarted) break;
  }
}
'''
time_unit = "seconds"
time_interval = "age"
intervals = "/10"
interval_unit = "days"

This code will for each issue go through the Issues history logs and check if and when the issue entered the status “In Progress” and use this date to calculate the time interval in days. Note that you can change the interval days in the “intervals” parameter, now it is set to 10-day intervals.

When you save this code, go to your Jira import options, and under the “Custom fields” tab, you should see this new custom field “Days in Development interval” - select it to be imported as a dimension and start the import. When the import is done, start creating a report and this dimension will be available under the “Custom fields” section.

Let me know if you need any additional assistance with this!
Best regards,
Nauris / eazyBI support

1 Like