Sum and Count of Story Points on Linked Issues

Issue #370 resolved
Travis Dent created an issue

We are setting up a hierarchy structure to implement SAFe. We set it up as the following:

  • Portfolio Epic (Issue Type) (We created) (Lives on a portfolio project kanban) Cause - Caused by link
  • Capability (Issue Type) (We created) (Lives in a Capability project Kanban) Cause - Caused by link
  • Feature (We are using the epic issue type for this) (Lives on a program project kanban) Epic link
  • Story (Lives on the team project Scrum) We create a board on this project to pull in features from the program project to show here on a filter board)

We run the Train and Sprints on a separate board so we can have all the teams on the same sprint.

Our issue is we need to get the count and sum of story points of all issues linked through the system. We would like it as a custom scripted field that does the addition so we can easily pull it into a jira filter on a confluence dashboard.

We are looking for:

  1. Count of all stories that roll up to a capability
  2. Count of all features that roll up to a Feature/Epic
  3. Sum of total story points that roll up to a capability
  4. Sum of total story point that roll up to a Feature/Epic
  5. Sum of total completed story points that roll up to Capability and Feature/Epics

These will give us the ability to see what is needed to accomplish and what is done in a fast glance.

What are your thoughts on this process and feasibility of the solution.

Thank you for the help,

Travis

Comments (10)

  1. Fidel Castro Armario repo owner

    Hi Travis,

    I haven't fully understood all the details of your proposal, so I need some clarifications. The problem is quite complex, so it would be very useful to give exact names to each element. This way we will be able to communicate efficiently and I will be able to give you faster the solution you need.

    Please, correct me where I'm wrong:

    1) There are 4 projects with the following names:

    • Portfolio
    • Capability
    • Program
    • Team

    2) There are 4 issue types:

    • Portfolio Epic in project Portfolio.
    • Capability in project Capability
    • Epic in project Program. This issue type represents a Feature*.
    • Story in project Team.

    3) Please, tell me how exactly how issue link type Cause - Caused by work. I need to know the issue types that are present at both ends of the issue link type, and the direction of the link. I also need the exact names of each direction of the issue link type. For example:

    • Portfolio Epic causes Epic in project Program (i.e., Feature).
    • Epic in project Program (i.e., Feature) is caused by Portfolio Epic

    I need to know all the issue links which are playing a role in the problem, explaining issue type at each end, and direction of the issue link type.

    4) How is the relation between Story issue type at Team project, and Capability issue type at Capability project?

    5) How is the relation between Epic at project Program (i.e., Feature) and Portfolio Epic at project Portfolio?

    6) When you say completed story points, do you mean story points of Story issues in certain statuses like Done, Resolved or Closed. Please, tell me which are those statuses?

  2. Travis Dent reporter

    Great Questions.

    1) There are 4 projects with the following names: * Portfolio (One Project) * Capability (One Project) * Program (One Project) * Team (Many Team Projects)

    2) There are 4 issue types: * Portfolio Epic in project Portfolio. * Capability in project Capability * Epic in project Program. This issue type represents a Feature*. * Story in project Team.

    3) Please, tell me how exactly how issue link type Cause - Caused by work. I need to know the issue types that are present at both ends of the issue link type, and the direction of the link. I also need the exact names of each direction of the issue link type.

    • Portfolio Epic Cause Capability (1 to Many)
    • Capability Cause Epic ( 1 to many)
    • Epic Epic Link Story(1 to Many)

    • Capability is caused by Portfolio Epic (Many to 1)

    • Epic is caused by Capability (Many to 1)

    4) How is the relation between Story issue type at Team project, and Capability issue type at Capability project?

    • These are sub linked to get from the Capability to the Story I have been using this query in JQL Tricks - issue in issuesWhereEpicIn("issue in linkedIssuesByDepth("Capability issue", 2)") AND type = Story ORDER BY Rank ASC
    • There is not a direct link between the Capability and the Story

    5) How is the relation between Epic at project Program (i.e., Feature) and Portfolio Epic at project Portfolio?

    • For this we are using the filter - issue in linkedIssuesByDepth("Portfolio Epic", 3) AND type = Epic ORDER BY Rank ASC

    6) When you say completed story points, do you mean story points of Story issues in certain statuses like Done, Resolved or Closed. Please, tell me which are those statuses?

    • Correct this is for all stories that are "Done"
  3. Fidel Castro Armario repo owner

    Travis,

    JIRA Workflow Toolbox doesn't provide calculated custom fields, but post-functions that store in an ordinary numeric custom field the calculated values you require. The problem is that it requires a transition to be executed in order to refresh the calculation when some of the story points has been edited, or when a Story is created or deleted.

    The solution I will propose you requires field Story Points to be removed from Edit screen in order to prevent the user from editing the field directly. Instead, we will create a global reflexive transition called "Edit Story Points" that will show the user a screen with field Story Points to allow the user edit or set the value of field Story Points. In that transition we will insert a post-function for re-calculate the value of fields you want to set with calculated values. This way we ensure that the values are re-calculated each time Story Points fields are edited.

    Is a solution like that valid for you, or do you need allowing you users edit Story Points directly in issue detail screen?

    I have a question in relation with your first 2 requirements:

    • Count of all stories that roll up to a capability
    • Count of all features that roll up to a Feature/Epic

    By count, do you mean that you need a numeric value (i.e., the number of stories and features), or a text with a comma separated list of issue keys? Or maybe you mean any other thing?

  4. Travis Dent reporter

    Thank you for this. We will try it out and see if it will solve our needs. I really appreciate the time.

    As for the counts, we are looking for numeric values ie number of stories and number of features.

  5. Fidel Castro Armario repo owner

    Ok, I will explain the solution step by step and I will use more than one post to do it.

    In this post I explain how to make "Story points" custom field editable with a global reflexive transition, instead of directly in issue detail screen:

    1. Create a screen called "Story Points" and add it only Story Points custom field.

    2. Remove Story Points custom field from your Edit screen. If you are sharing the same screen for Edit and View operations, you will have to split it in two, and remove the field only from Edit screen.

    3. Create a global reflexive transition called "Edit Story Points". Global means that the transition is available from any status of the workflow, and reflexive means that it doesn't change issue status, i.e., it has the same origin and destination status. In the linked screenshot is shown how to create one of these transitions.

    4. Associate screen Story Points to transition Edit Story Points. You have to edit the transition to do it.

    After these modifications field Story Points only will be editable using transition Edit Story Points. Now you have bigger control on the edition of these field. You can use conditions or validators to limit the users that can edit these fields, validate the values entered (for example requiring that the values are in Fibonacci sequence), or adding post-function to execute after edition, which is the reason we are doing it in these particular case.

  6. Fidel Castro Armario repo owner

    In this post I explain how to obtain in an auxiliary field (Ephemeral string 1) the issue key of the Capability of a certain Story. This is an intermediate result that we will need in our implementation.

    To do it you should use "Copy a parsed text to a field" post-function with the following configuration:

    • Target field: Ephemeral string 1
    • Parsing mode: advanced
    • Text to be parsed:
    toString(linkedIssues("is caused by", linkedIssues("has Epic")))
    

    like shown in the screenshot: Captura de pantalla 2016-07-14 a las 9.01.08.png

    In order to confirm that it works as expected, do the following:

    • Add the post-function to Edit Story Points transition.
    • Replace Ephemeral string 1 with New comment at Target field parameter.

    Now, you can edit the Story Points field at a Story issue executing Edit Story Points, and after that a comment will be automatically created containing the issue key of the Capability issue that correspond to the Story issue.

  7. Fidel Castro Armario repo owner

    As in the previous post, now I will explain how to obtain in Ephemeral string 2 auxiliary field the issue key of the Portfolio Epic of a certain Story.

    To do it you should use "Copy a parsed text to a field" post-function with the following configuration:

    • Target field: Ephemeral string 2
    • Parsing mode: advanced
    • Text to be parsed:
    toString(linkedIssues("is caused by", linkedIssues("is caused by", linkedIssues("has Epic"))))
    

    Follow the same instructions as in previous post in order to confirm that it works as expected.

  8. Fidel Castro Armario repo owner

    In this post I explain how to obtain the sum of Story Points at Portfolio Epic and Capability issues:

    You have to add two post-functions in transition Edit Story Points AFTER the 2 ones you have already added for setting Ephemeral string 1 and Ephemeral string 2.

    The 2 post-functions you have to add are instances of "Write field on issues returned by JQL query" with the following configurations:

    Post-function 1: Setting numeric custom field "Sum of Story Points" at Capability** issues.

    Captura de pantalla 2016-07-14 a las 9.48.27.png Captura de pantalla 2016-07-14 a las 9.48.41.png

    Parameter Source value is:

    sum(fieldValue({nnnnn}, distinct(linkedIssues("is Epic of", linkedIssues("causes", linkedIssues("is caused by", linkedIssues("has Epic")))))))
    

    replacing nnnnn with the field code for Story Points custom field in your particular JIRA instance.

    Parameter JQL Query is:

    issuekey in (%{00061})
    

    Note that:

    • %{00061} is field code for Ephemeral string 1.
    • I have assumed that both directions for issue link Cause are: "is caused by" and "causes". Please, correct it if necessary.

    Post-function 2: Setting numeric custom field "Sum of Story Points" at Portfolio Epic issues.

    Captura de pantalla 2016-07-14 a las 9.59.03.png Captura de pantalla 2016-07-14 a las 9.59.24.png

    Parameter Source value is:

    sum(fieldValue({nnnnn}, distinct(linkedIssues("is Epic of", linkedIssues("causes", linkedIssues("causes", linkedIssues("is caused by", linkedIssues("is caused by", linkedIssues("has Epic")))))))))
    

    replacing nnnnn with the field code for Story Points custom field in your particular JIRA instance.

    Parameter JQL Query is:

    issuekey in (%{00062}) 
    

    Note that %{00062} is field code for Ephemeral string 2.

    Once you have added these two post-function to Edit Story Points transition it will look like this:

    Captura de pantalla 2016-07-14 a las 10.03.06.png

    Add this same 4 post-function to Create Issue transition in your Story workflows, just AFTER post-function "Creates the issue originally".

    Now, each time you create a new Story or edit Story Points field in a Story, custom field Sum of Story Points will be updated on Portfolio Epic and Capability issues.

    Once you achieve to implement this part of the solution successfully, we can continue with the rest of your requirements.

  9. Log in to comment