Calculating Total user stories based on epics fields

Hi,

The formula is generally correct for counting the Stories having the Target PI of grandparent matching the PI from the report context. You are also right that this approach has a significant risk of performance problems.

There are a couple of techniques to make such calculations more efficient. First, it is possible to define a new Javascript calculated custom field that would inherit down the Target PI from the upper level of the hierarchy down to the User stories. This approach is limited to work with the single value custom fields in Jira.

You can add to the advanced settings of eazyBI the lines like this:

[jira.customfield_cf_inherited]
name = "Target PI Inherited"
data_type = "string"
dimension = true
javascript_code='''
if (issue.fields.customfield_NNNNN ) {
  issue.fields.customfield_cf_inherited=issue.fields.customfield_NNNNN
}
'''
update_from_issue_key = "epic_key" ## use the correct id of the upper hierarchy level

You need to use the custom field ID instead of NNNNN and the correct name of the level ID instead of the “epic_key”. Once you import this field as a dimension, the simple filtering in the report pages should do the count (you may also add the Issue type filter in the report).

In the case of the Labels, it is possible to create a similar construction using the Issue link field dimension.
You can see a similar example of configuration here:
https://docs.eazybi.com/eazybijira/data-import/advanced-data-import-options/issue-link-field-dimensions#Issuelinkfielddimensions-FeatureLabel

Kindly,
Janis, eazyBI support