How to check Sum Story POints of Linked issues

I use a calculated custom field on data import, to check if Features (and Enabler Features) has ‘implemented by’ Stories (and Enablers).
here is the javascript:

// Check if issue has any links

if (!issue.fields.issuelinks 
    || issue.fields.issuelinks.length === 0 || issue.fields.customfield_12800 === null || issue.fields.customfield_12800 === 0 ) {

  return "No";

}
else {
// Look through all issue links

for (let i = 0; i < issue.fields.issuelinks.length; i++) {

  let link = issue.fields.issuelinks[i];

  // Check if link type name is "Implemented by" in either direction
 if (link.type && link.type.inward === "is implemented by" && link.inwardIssue) {
  if (link.type && link.type.inward === "is implemented by" 
      && 
      (link.inwardIssue.fields.issuetype.name==='Story'
      || link.inwardIssue.fields.issuetype.name==='Enabler')
      
     )
      {

    return "Yes";

  }
 }
}
 
// No "Implemented by" links found

return "No";
}

Then, in the report, I count the number of features and enablers, with certains criterias :

( 
  [Measures].[Issues created],
  [Issue Type].[Feature & EF],
  [Status].[Except Funnel | Analysis | Canceled],
  [Has Implemented by].[Yes]
)

-

(
  [Measures].[Issues created],
  [Issue Type].[Feature & EF],
  [Status].[Except Funnel | Analysis | Canceled],
  [Component].[(no component)],
  [Has Implemented by].[Yes]
)

But how to add the following criteria: count only Features (and Enabler Features) where Sum of Story Points of linked “implements” Stories (and Enablers) > 0
Please note that in my case, Stories ‘Implements’ Features.

I defined that measure: Count child SP = 0
CASE WHEN
Count(
Filter(
[Issue].CurrentHierarchyMember.Children,
[Measures].[Issue Story Points] > 0)
) <= 0
THEN 1
END

And then did added that measure:
(
[Measures].[Issues created],
[Issue Type].[Feature & EF],
[Status].[Except Funnel | Analysis | Canceled],
[Has Implemented by].[Yes]
)

(
[Measures].[Issues created],
[Issue Type].[Feature & EF],
[Status].[Except Funnel | Analysis | Canceled],
[Component].[(no component)],
[Has Implemented by].[Yes]
)

[Measures].[Count child SP = 0]

But it doesn’ look a best practice, the drill trhrough looks not great.
Better ideas?

@Mikolaj_Umiastowski

There is no good way to check story points for linked issues with Javascript during import.
The list of fields for linked issues in Jira is limited to few standard fields “summary, status, prority, issue type”

To count issues by their linked issue story points in eazyBI, you create a scripted field in Jira (and import it in eazyBI for Features and Enabler Features to check story points value for linked issues, OR you create custom calculations with calculated measures to check the story points for imported linked issues, but that can be extremely slow if you have large eazyBI accounts with many projects and issues imported in the “Issues” cube from Jira.

In this case, I would recommend discussing the best possible solution with support@eazybi.com directly.

Martins / eazyBI

Thanks for the help!

1 Like

is there any possibility with Jira rest API import, with the postDocument function, as documented here : Data adjustments using JavaScript

It looks like I could get the story points custome field value of linked issues.

I guess I could adapt the example code of the page, to get linked issues “implements” and their story points and then sum up.
Here is the example code


if (doc.fields.subtasks) {
    // create a post request body
    body = {
        jql: "Color is not EMPTY AND resolution is not EMPTY AND parent = " + doc.key,
        fields: [
            "customfield_11303" // custom field Color in sub-tasks
        ]
    }

    // call post request 
    response = postDocument("/rest/api/2/search", body, {
        content_type: 'application/json'
    });
    // there is a response with sub-tasks. get color from any sub-tasks and set the hottest color for the parent issue
    if (response && response.issues) {
        Red = false;
        Green = false;
        Yellow = false;
        for (var i = 0; i < response.issues.length; i++) {
            subtaskColor = response.issues[i].fields.customfield_11303.value;
            switch (subtaskColor) {
                case "Red":
                    Red = true;
                    break;
                case "Yellow":
                    Yellow = true;
                    break;
                case "Green":
                    Green = true
                    break;
            }
        }
        // set the color for parent issue
        if (Red) {
            doc.color = "Red"
        } else if (Yellow) {
            doc.color = "Yellow"
        } else if (Green) {
            doc.color = "Green"
        }
    }
}