All eazyBI for Jira eazyBI for Confluence Private eazyBI

Current status age
eazyBI for Jira

The "Current status age" dimension calculates the age of issues in current status and group data in age intervals. If the issue's status has not changed, age is calculated from the creation date.

Account-specific calculated field

Account specific calculated fields are defined in Source Data → Import options.

Settings for the new field

Internal name

ageincurstat

Display nameCurrent status age
Data type

integer 

Dimension

Additional advanced settingstime_unit = "seconds"
time_interval = "age"
intervals = "1,7,30,365"
interval_unit = "days"

Custom JavaScript code:

if (!issue.fields.resolutiondate) {
    var fcd;
    if (issue.changelog && issue.changelog.histories && issue.changelog.histories.length > 0) {
        var histories = issue.changelog.histories;

        for (var i = histories.length - 1; i >= 0; 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 === "status") {
                        fcd = history.created;
                    }
                }
            }

            if (fcd) {
                break;
            }
        }
    }

    if (fcd) {
        return Math.floor(Date.parse(fcd) / 1000);
    } else {
        return Math.floor(Date.parse(issue.fields.created) / 1000);
    }
}

Global calculated field

Global calculated fields are defined in eazyBI advanced settings.

Here are the settings for the new field definitions. You should insert the JavaScript (the code given above) below the line // Insert here the Custom JavaScript codeKeep the opening and closing quotation marks. ''', do not delete them.

[jira.customfield_ageincurstat]
name = "Current status age"
data_type = "integer"
dimension = true
javascript_code = '''
  // Insert here the Custom JavaScript code
'''
time_unit = "seconds"
time_interval = "age"
intervals = "1,7,30,365"
interval_unit = "days"