Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Create a calculated member similar to resolution interval

Doug Artman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 1, 2018

Using eazyBI I can easily create a histogram which bins the number of days it takes to resolve an issue and display as a histogram using the resolution interval member.  I'd also like to do the same thing but counting the days from when an issue was created to when it entered a status before RESOLVED.  Any suggestions on how to accomplish this?

1 answer

0 votes
Janis Plume _eazyBI_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 5, 2018

Hi Dough,

The chart like this can be done by creating a Javascript custom field in eazyBI and building a new interval dimension on top of it. Please, find below advanced settings creating the custom field and the interval dimension. Note to adjust the Javascript code with your status name. Please, see the eazyBI documentation for more details on the Javascript custom fields here:

https://docs.eazybi.com/display/EAZYBIJIRA/JavaScript+calculated+custom+fields

[jira.customfield_time_till_status]
name = "Duration till status"
data_type = "decimal"
measure = true
dimension = true
javascript_code = '''
var activestatus = "Done";
var datefrom = Date.parse(issue.fields.created);
var dateto = new Date;
var accepted = false;

issue.changelog.histories.forEach(function(history){
history.items.forEach(function(historyItem){
if (historyItem.field == "status") {
         statusto = historyItem.toString;
if(statusto.equals(activestatus)) {
accepted = true;
dateto = Date.parse(history.created);
}
}
});
});

if(accepted) {
issue.fields.customfield_time_till_status = (dateto - datefrom) / 1000;
}
'''
time_unit = "seconds"
time_interval = "duration"
intervals = "/10"
interval_unit = "days"

After the import of the custom field, you will see the new interval dimension created in the data cube and will be able to use it in your reports.

Best regards,
Janis, eazyBI support 

Colton.Kosicek
Contributor
January 26, 2022

Hey Janis,

This is great! can i do multiple intervals? As this requires a Jira admin to add the advanced settings I am trying to do it once for as many scenarios as able.

Janis Plume _eazyBI_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 26, 2022

Hi,

Sure, you can replicate the same code with different statuses to create interval dimensions for different statuses. The following things need to be considered when creating new interval dimensions:

1) Assign a new field ID for each field, e.g. 

[jira.customfield_time_till_status_my_status]

2) Specify a new name:

name = "Duration till My Status"

3) The last line of Javascript code must assign the value to the new custom field ID:

issue.fields.customfield_time_till_status_my_status = (dateto - datefrom) / 1000;

Best regards,

Janis eazyBI support

Colton.Kosicek
Contributor
January 27, 2022

Thank you Janis! Is it possible to make unique calculated members as well? Or will the original "XXXX" number determine how the new members are defined as well?

(dateto - datefrom) / XXXX

 Thanks,

Colt

Janis Plume _eazyBI_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2022

Hi Colt,

 

The division by 1000 in this code is needed to translate milliseconds of the timestamp to seconds. eazyBI stores the calculated seconds and use them for the interval calculation.

It is possible to configure in eazyBI the interval dimensions with different ranges. Please, check some examples of how to do that here: https://docs.eazybi.com/eazybi/analyze-and-visualize/interval-dimensions.

You might wish to check more examples on Javascript calculated custom fields in eazyBI: https://docs.eazybi.com/eazybi/data-import/data-from-jira/jira-custom-fields/javascript-calculated-custom-fields

 

Kindly,

Janis, eazyBI support

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events