Calculate the count of transitions for Exposure field

eazyBI allows importing and analyzing changes in single value custom fields. You would like to enable the option import changes for the custom field, though.

However, the default measures will show you only how many issues were moved to/from a particular custom field value over time. You can define a custom measure to track the changes for a custom field:

([Measures].[Transitions to],
 [Transition Field].[<custom field name>])

The measure above will count values set at the issue creation as well.

It might be a bit tricky and complex if you would like to count changes between two different values. For example, a count of issues moved from High to Critical. While you can try using the MDX formula for this (compare the timestamp of a status move from High with a timestamp of a status move to Critical), it might get even messier if an issue changes values in this field several times.

Therefore, it would be more reliable and relevant to define a new dimension and measure with calculated JavaScript code to represent particular changes and count those changes.

Here is an example calculation for default field Priority for this case. You would like to replace priority with your custom field Name (case sensitive)

#define dimension to represent transctions changes in custom field
name = "Priority changes" # the the dimension name and address it in parameter multiple_dimensions in the definition below
data_type = "string"
dimension = true
separate_table = true

#define measure tocount those changes
name = "Priority changed"
data_type = "integer"
measure = true
multiple_dimensions = ["Priority changes","Time"] # set the dimension name from the definiiotn above
javascript_code = '''
var priorityChanges = [];
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 == 'priority' && item.toString != item.fromString  ){ // define a custom field name - case sensitive instead of 'priority'
    	toValue = item.toString ? item.toString : "(none)";
    	fromValue = item.fromString ? item.fromString : "(none)";
// add change in this pattern: fromValue => toValue,changeDate,1
priorityChanges.push(fromValue + " => " + toValue + "," + history.created.toString().substr(0,10) + ",1");
// add all changes as a result with a new line divider 
  issue.fields.customfield_pri_changed = priorityChanges.join("\n");

I would suggest renaming the variable names to reflect the customfield so that it would be easier to understand what the code does.

  1. Test javaScript code:
    Open import options for edit and apply the JavaScript to Custom JavaScript code. Test the code with several issues. Please check how to test the javascript code.
    Remove the code from this field after testing.

  2. Add custom field definitions to eazyBI advanced settings.
    You might need help from a Jira administrator or eazyBI administrator to do this for you. eazyBI advanced settings are common for all accounts, and only Jira/eazyBI administrators have access to the settings.

  3. Select custom fields for import.
    Open source data Jira import options for edit after changes in advanced settings and select both custom fields for import and run an import. Import will create a new dimension and measure.

You would like to use a new dimension in combination with this new measure for your reports:

Daina /