Hi,
The default measure of Days in transition status does not split the days by the period selected in the report. Instead, it shows the full number of days spent in the status for the period when the issue transitioned from the status.
It is possible to create a workaround with a Javascript calculated custom field.
I used the following advanced settings for the solution:
[jira.customfield_wd_inst_by_month]
name="Workdays in status by months"
data_type="decimal"
measure=true
multiple_dimensions=["Time","Transition Status"]
javascript_code='''
var datefrom = issue.fields.created;
var daysinstatus = 0;
var result = new Array;
issue.changelog.histories.forEach(function(history){
history.items.forEach(function(historyItem){
if (historyItem.field == "status") {
statusto = historyItem.toString;
statusfrom = historyItem.fromString;
dateto = history.created;
df = new Date(Date.parse(datefrom));
dt = new Date(Date.parse(dateto));
if (df.getMonth() == dt.getMonth() && df.getFullYear()==dt.getFullYear()) {
daysinstatus=(dt-df)/1000/3600/24;
result.push(dateto.substr(0,10)+","+statusfrom+","+daysinstatus);
} else {
while (df<dt) {
first_day_next_month=new Date(df.getFullYear(), df.getMonth() + 1, 1);
last_day_of_month = new Date(df.getFullYear(), df.getMonth() + 1, 0);
daysinstatus = dt>first_day_next_month ? ((first_day_next_month-df)/1000/3600/24) : ((dt-df)/1000/3600/24);
result.push(strftime("%Y-%m-%d",(last_day_of_month>dt ? dt : last_day_of_month))
+","+statusfrom+","+daysinstatus);
df=first_day_next_month;
}
}
datefrom = history.created;
}
});
});
if(result) {
issue.fields.customfield_wd_inst_by_month = result.join("\n");
}
'''
This solution creates a new measure to show the split of the Time by months. The measure expects that the Monthly level of the Time hierarchy is used in the report:
Kindly,
Janis, eazyBI support