Help - Need calulated measure(s) for Counting changes in Issue "Types"

for example: I have various issue types, one is called “L3 Support” and another is “Escalation to RandD” … and they change constantly but I need to measure and count how long (in days) an issue has been in various “types”…(similar to 99.9% of the info out here having to do with counting how long issues are in various status’ and when they transition)… but there is nothing to help out with “type”… for example: if an issue was created on Nov 2 as an “L3 Support” type and then changed 4 days later to an “Escalation to RandD”… i need to create a report that says issue abc-123 spent 4 days as an “L3 support” type and then 5 days or whatever days as an “Escalation to RandD”… I have spent >70 hours trying to figure this out… I need the calculated measure code, the rows and columns, etc… please help!!!

also… if you could, indicate what should be literally typed and what is depending on my specific local naming convention of specific condition… like when if you send someone code, they indicate substitute your own name for the text in green or in brackets, etc… thanks

Hi @erichard00,

Out of the box, there is no such measure to get time spent in each issue type. You may try to build custom calculation and count the time between two dates based on measures Transition to first timestamp and Transition from last timestamp, but this won’t be accurate if an issue can get the same issue type twice and might be a quite heavy calculation.

I would recommend import new measure using JavaScript calculated custom fields. You may use the code for “Days for Assignee” as an example to build measure for “Days for Issue Type”.

  1. Go to eazyBI Advanced Settings and paste in the custom measure definition with JavaScript. Note that those settings are available only to Jira system administrators and eazyBI admins.
    The code for the custom measure with JavaScript might look like this:
name = "Days for Issue Type"
data_type = "decimal"
measure = true
multiple_dimensions = ["Time","Issue Type"]
javascript_code = '''
var issuetypehistory = new Array();
var datefrom = issue.fields.created;
var issuetype = null;
resolution = false;

  if (historyItem.field == "issuetype" && ! resolution) {
   issuetype = historyItem.fromString;
   dateto = history.created;
     duration = (Date.parse(dateto) - Date.parse(datefrom)) / 1000 / 60 / 60 / 24;
     issuetypehistory.push(dateto.toString().substr(0,10) + "," + issuetype + "," + duration); 
   datefrom = dateto;
   issuetype =;
 if (historyItem.field == "resolution") {
   if ( resolution = true;
   else resolution = false; 

if (issue.fields.resolutiondate && (issue.fields.issuetype || issuetype)) {
 if (!issuetype) issuetype =;
 duration = (Date.parse(issue.fields.resolutiondate) - Date.parse(datefrom)) / 1000 / 60 / 60 / 24;
 issuetypehistory.push(issue.fields.resolutiondate.toString().substr(0,10) + "," + issuetype + "," + duration); 

issue.fields.customfield_days_for_issuetype = issuetypehistory.join("\n");
  1. Then go to import options and select custom field “Days for Issue Type” for data import as measure and as property.

  2. After data import, a new measure Days for Issue Type (Measures -> Select member -> Custom field) will be available for your reports. Use it with Issue Type dimension in the report.

Zane /

1 Like

Thank you so much for this and the previous replies from you… I was out of work for a few weeks for various reasons but now getting back and I will review your feedback in detail and let you know results… - Ed