Issues Scheduled

I have created a measure which provides a count of issues where the scheduled date is the current week or in the past i.e. I want to filter out issues where the scheduled date is in the future.
This is the query:

NonZero(count(
Filter(Descendants([Issue].CurrentMember,[Issue].[Issue]),
[Measures].[Issues with scheduled time]>0 and
isempty([Measures].[Issues resolved]) and
DateCompare([Measures].[Issue Scheduled Time],Now())<0
)
))

Is there any way to have this only include the FIRST scheduled time?
i.e. if a ticket is rescheduled I want to count it when it was first set, not the time it was rescheduled for.

Would appreciate any feedback on this.

Hi,

In this case, I would recommend creating a new Javascript calculated field via eazyBI advanced settings that would return the first Scheduled time

Try this code:

[jira.customfield_fscht]
name = "First scheduled time"
data_type = "date"
measure = true
javascript_code = '''
if (issue.fields.customfield_14954){
var fscht;
if (issue.changelog && issue.changelog.histories && issue.changelog.histories.length > 0) {
  var histories = issue.changelog.histories;
  for (var i = 0; i < histories.length; 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 == 'Scheduled Time' && item.to) {
          fscht = item.to.substr(0, 10);
        }
      }
    }
    if(fscht) {
      break;
    }
  }
}
}
issue.fields.customfield_fscht = fscht;
'''

Then open eazyBI import options and select this new custom field to import as measures and property. Later use new measure and property in your calculated measure for final calculation

Martins / eazyBI support

2 Likes