# Calculate Story points and number of Bugs for the linked issues

**URL:** <https://community.eazybi.com/t/calculate-story-points-and-number-of-bugs-for-the-linked-issues/19175>\
**Category:** Questions & Answers\
**Tags:** customhierarchy, calculatedmembers\
**Created:** [November 27, 2024, 5:36pm UTC](https://community.eazybi.com/t/calculate-story-points-and-number-of-bugs-for-the-linked-issues/19175 "2024-11-27T17:36:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anna](https://community.eazybi.com/letter_avatar_proxy/v4/letter/a/779978/32.png) [@Anna](https://community.eazybi.com/u/Anna)\
**Post date:** [November 27, 2024, 5:36pm UTC](https://community.eazybi.com/t/calculate-story-points-and-number-of-bugs-for-the-linked-issues/19175/1 "2024-11-27T17:36:03Z")

</div>

Hi!  
I am new to EasyBI and wasn’t able to find answer in similar topics

I need the report which shows for each Reporter in timeline perspective

- number of closed issues with type Stories and/or Tasks (I was able to create by applying metric Issues closed),
- number of issues with type Task linked to those stories (I was able to calculate by creating custom metric - see below)
- number of bugs that are linked to those closed stories AND to those linked tasks (as a total/sum amount) (was not able to calculate)
- Total amount of closed Story points assigned for closed Stories ( I was able to calculate by applying metrics Story points closed)
- Total amount of Story points for the linked Tasks ( was not able to calculate)

I could calculate number of bugs linked to the closed Stories (similar to how I calculate linked tasks) by I don’t understand how to calculate bugs to both closed Stories and linked to them Tasks.

And second problem - how to calculate sum of Story Points for the linked Tasks.

I would appreciate help here.

_Custom metric for calculation Tasks linked to closed stories (took from example 4 Issue links and hierarchies)_

```auto
CASE 
WHEN
  [Issue].CurrentMember.Level.Name = "Issue"
  AND
  [Tasks].Currentmember is [Tasks].Defaultmember
THEN
  Nonzero(Count(
    [Issue].CurrentHierarchy.GetLinkedmembers('Tasks')
  ))
ELSE
  NonZero(Sum(
    Descendants([Tasks].Currentmember, [Tasks].[Tasks]),
    [Measures].[Issues closed]
 ))
END

```

Clarification of my model of accounting tickets in jira - example:  
Story 1 → Task 1, Task 2,  
Story 1 → Bug 1. Bug 2  
Task 1 → Bug 3,  
Task 3 → Bug 4  
Story 2 → Bug 5, Bug 6  
Stories and Tasks are estimated in Story Points.

---

<div class="post-metadata">

**Author:** ![gerda.grantina](https://community.eazybi.com/user_avatar/community.eazybi.com/gerda.grantina/32/1994_2.png) [@gerda.grantina](https://community.eazybi.com/u/gerda.grantina)\
**Post date:** [January 20, 2025, 3:34pm UTC](https://community.eazybi.com/t/calculate-story-points-and-number-of-bugs-for-the-linked-issues/19175/2 "2025-01-20T15:34:18Z")

</div>

Hello,  
My apologies for the delayed response. From your question, it looks like you have already solved many of your inquiries.  
There is one more report from which you can copy formulas: [Stories with Bugs details - Issues - eazyBI Demo Training - eazyBI](https://eazybi.com/accounts/22010/cubes/Issues/reports/376216-stories-with-bugs-details)

For example, you can transform, “Hours spent on linked bugs” to calculate the Story points instead of hours spent:

```mdx
-- annotations.group = 4 Issue links and hierarchies
CASE 
WHEN
  [Issue].CurrentMember.Level.Name = "Issue"
  AND
  [Tasks].Currentmember is [Tasks].Defaultmember
THEN
  -- retrieve Tasks information from Issue property Tasks
  CASE WHEN
    NOT isEmpty([Issue].CurrentHierarchyMember.Get('Tasks'))
  THEN
    NonZero(SUM(
    [Issue].[Issue].GetMembersByKeys(
      [Issue].CurrentHierarchyMember.get('Tasks')),
      DefaultContext((
        [Measures].[Story Points created],
        [Issue].CurrentMember,
        [Time].CurrentHierarchyMember))
    ))
  END
ELSE
 -- total calculation for any issue, data on Tasks level
  NonZero(SUM(
    Filter(
      Descendants([Tasks].Currentmember, [Tasks].[Tasks]),
      -- filter out Tasks with reference to Issue
      ([Measures].[Issues created],
      [Logged by].Defaultmember, 
      [Time].CurrentHierarchy.Defaultmember) > 0),
    -- search for Bug in Issue dimension, use in a tuple with measure, logged by and time, ignore anything else with DefaultContext    
    DefaultContext((
      [Measures].[Story Points created],
      [Issue].[Issue].GetMemberByKey([Tasks].Currentmember.Key),
      [Time].CurrentHierarchyMember, -- allow selection by Time
      [Tasks].DefaultMember
    ))
 ))
END

```

best regards,  
Gerda // [support@eazybi.com](mailto:support@eazybi.com)
