Defect Density Rate

Hi all — I’m trying to build a Defect Density trend per sprint:

Defect Density (%) = (Bugs created in the sprint) / (Total Story Points resolved in the sprint)

Goal: Count only bugs that originate during the sprint (from in-sprint testing). If a bug was created in Sprint 1 and later moved/pushed to Sprint 2, it should count for Sprint 1 only, not Sprint 2.

Problem: Using the standard “Bugs created” or “Sprint issues added” pulls in bugs that were created earlier and only added/pushed into the sprint later.

Constraints

  • Rows: [Sprint] (includes some aggregated sprint members like Q3S1, Q3S2, etc.)

Hi @Sruthi_Vijayakumar ,

You can use a calculated measure to count only bugs that were created during the sprint period and added to that Sprint.

As this requirement has two separate criteria, the logic for calcaution is to iterate through individual issues and check their creation date AND check if they were added to this sprint. Use function Sum() and DescendantsSet():

Sum(
  --set of issues, iterate though individual bugs
  Filter(
    DescendantsSet([Issue].CurrentMember,[Issue].[Issue]),
    --check the issue creation date falls in Sprint
    DateBetween(
      [Measures].[Issue created date],
      [Measures].[Sprint actual start date], 
      [Measures].[Sprint actual end date]
    )
  ),
  --sum up only those bugs that were added to the spint
  ([Measures].[Sprint issues added],
  [Issue Type].[Bug])
)

As you see, the Sprint start and end dates are essential to check if a bug was created during the sprint.

If you have calcauted members on report rows for sprints, then you should update the calcaution further. Iterate through the individual sprints of calculated members on report rows using the function CalculatedChildrenSet(), then sum up the created bugs of those sprints:

Sum(
  --set of individual sprints for calcauted memebers on report rows
  CalculatedChildrenSet([Sprint].CurrentHierarchyMember),
  --for each sprint sum up created bugs
  Sum(
    --set of issues, iterate though individual bugs
    Filter(
      DescendantsSet([Issue].CurrentMember,[Issue].[Issue]),
      --check the issue creation date falls in Sprint
      DateBetween(
        [Measures].[Issue created date],
        [Measures].[Sprint actual start date], 
        [Measures].[Sprint actual end date]
      )
    ),
    --sum up only those bugs that were added to the spint
    ([Measures].[Sprint issues added],
    [Issue Type].[Bug])
  ) 
)

For both measures, set measure formatting to Numeric → Integer, to represnt measure values correctly not as dates (more details here: Calculated measures).

Best,

Zane / support@eazyBI.com