Calculate Story points and number of Bugs for the linked issues

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)

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.