Issue due date old values

Hi,
I’m trying to build a report in eazybi using jira history due date field
I have the history imported and a field of “issue due date old values” - [Issue].CurrentHierarchyMember.get(‘Due date old values’)
it returns the values like this on the left: (in a comma seperated string/list)

I want to extract the first value (earliest value) so I can build an actual vs planned report
I tried using this measure:
ExtractString(
[Issue].CurrentMember.get(‘Due date old values’),
“(.),.”,
1
)
but it will work only when I have 2 dates, if I have one date or above 2 it won’t return correctly. (see on the above on the right)
when I have one value it won’t return anything at all
do you have a solution for it?
Thanks!

You are almost there.
It is on the Regex you are using.

can you try this one?

ExtractString(
[Issue].CurrentMember.get('Due date old values'),
"([^,]+)"
)

That Regex reads from the start of your list and gather the info until the comma

1 Like

Thanks! it’s working
is there a way to take the earliest date instead of the first? (or sort it before I take the first value)

You are already having it at the 1st element as you commented
If it is not, you have to update your Custom logic to sort it and then get it. Like:

array.sort(function(a,b){
  return new Date(b.date) - new Date(a.date);
});

Although, maybe you want to return only the oldest one. So you can create a Custom Dimension to gather that information. And the code would be like:

if (issue.fields.<NAME OF YOUR FIELD>) {
  var dates = issue.fields.<NAME OF YOUR FIELD>.split(","); 
  dates.sort();   
  return dates[0];
}
1 Like

Hi @Moral and @Nacho

As @Nacho pointed out, I recommend adjusting the JavaScript code. This will order the values during the import, making them readily available after they have already been ordered.

If you wish to still use the existing unordered list, you can use an MDX formula like this:

TimestampToDate(
  Min(
    Filter(
      Descendants([Time].CurrentMember, [Time].[Day]),
      AnyDateInPeriod(
        [Issue].CurrentMember.get('Due date old values'),
        [Time].CurrentMember
      )
    ),
    DateToTimestamp(
      [Time].CurrentHierarchyMember.StartDate
    )
  )
)

​Best regards,
​Nauris