Getting only the first/lowest value from a multi select field

Hi @Davo,
There are two approaches to getting this information.
First is using MDX calculation that iterates through issues, sorts the affected versions by release date, gets the earliest one, and counts the issue towards it. This calculation could lead to performance problems if you have a lot of issues in your data cube:

Sum(
  Filter(
    Descendants([Issue].CurrentMember,[Issue].[Issue]),
    [Measures].[Issues created]> 0
    AND
    NOT IsEmpty([Measures].[Issue affects versions])
    ),
  CASE WHEN
    Order(
        Filter([Affects Version].[Version].Members,
        [Measures].[Issues created]>0
      ),
      [Affects Version].CurrentHierarchyMember.Get('Release date'),
      ASC
      --filter the report by the earliest version that matches the version selection in pages
    ).Item(0).Name = [Affects Version].CurrentHierarchyMember.Name
  THEN
    [Measures].[Issues created]
  END
)

The second approach is using a JavaScript custom field. Here is a solution for the “Latest affects version”:

You can transform the code and get the “Earliest affects version” using this field definition:

[jira.customfield_earliest_aversion]
name = "Earliest Affects Version"
data_type = "string"
dimension = true
javascript_code = '''
var versionList = [];
if (issue.fields.versions ) {
for (var i=0; i < issue.fields.versions.length; i++) {
  var versionName = issue.fields.versions[i].name;
  versionList.push(versionName);
}
}

if (versionList){
  issue.fields.customfield_earliest_aversion = versionList[0];
}
'''

Select the field for the import, and after the import, you will have a new dimension that holds only the “Earliest affects version” values.

best,
Gerda // support@eazybi.com