How can i show the change history of date custom field?

Hi,

Date-picker custom fields can not be imported as dimensions in eazyBI.
eazyBI does not allow importing another dimension with date type since there is already one “Time” dimension by default.
A workaround would be using a pre-calculated field (using Javascript in advanced settings) that returns the string output for every issue with all the dates and new timestamp when it was changed (see attachment with table report)
Then using MDX calculated measure this timestamp is converted to Date (see all attached images) and shown for each time period

Try this code for the Javascript code:

[jira.customfield_eetch]
name = "Estimated end timestamp changes"
data_type = "decimal"
measure = true
multiple_dates = true
javascript_code = '''
dateChangeStrings = [];
whenDateChanged = issue.fields.created; //.toString().substr(0,10);
newDateChange = null;
duedateAsTimeChangeStamp = null;
issue.changelog.histories.forEach(function(history){
 history.items.forEach(function(historyItem){
  if (historyItem.field == "Estimated End Date" ) {
   newDateChange = historyItem.from;
   if(newDateChange){
     duedateAsTimeChangeStamp = Date.parse(newDateChange);
     dateChangeStrings.push(whenDateChanged.toString().substr(0,10) + "," + duedateAsTimeChangeStamp/1000);
     dateChangeStrings.push(history.created.toString().substr(0,10) + "," + -duedateAsTimeChangeStamp/1000);
   }
   whenDateChanged = history.created;
  }
  });
});
if (issue.fields.customfield_NNNNN) {
  dateChangeStrings.push(whenDateChanged.toString().substr(0,10) + "," + 
  Date.parse(issue.fields.customfield_NNNNN)/1000) ;
}
issue.fields.customfield_eetch = dateChangeStrings.join("\n");
'''

And then the following code for MDX calculated measure “Estimated end history” (with Month Day Year format) when the pre-calculated field is selected via import options and imported as measures

TimestampToDate(NonZero(Sum(
  {PreviousPeriods([Time].CurrentHierarchyMember), [Time].CurrentHierarchyMember},
   [Measures].[Estimated end timestamp changes]
)))

Martins / eazyBI team.

1 Like