Feature to User Stories to Bugs & Test Cases

I am working on a report where I need to display Features row wise along with the count of associated Stories followed by the sum of Bugs and Test Cases (TestXY) linked to each of the associated Stories.

I have already defined two Calculated Custom Fields in Advanced Settings -

  1. User Story Defect Count > This calculates the number of Defects associated with a User Story
  2. User Story Test Case Count > This calculates the number of Defects associated with a User Story

I am able to display the Stories row wise along with User Story Defect Count and User Story Test Case Count as below.

However, I am unable to tie these to the Feature. All User Stories have the Feature Link populated. Can you please help me here?

Thanks,
Ranjan