How to find coverage percentage?

Hi, I am trying to create a calculated field where it displays a percentage based off how many stories have coverage. In this case, coverage would be if a story has a test (xray test created).

For example, if there are 100 stories with 50 having test cases, it would display 50%

I thought it was a simple calculation such as the formula below, but nothing appears.
[Measures].[Issues created]/ [Measures].[Xray Tests created]

I saw a similar formula and tweaked it to my needs but I run into the issue of “Formula is not valid:
MDX object ‘[Xray Tests created]’ not found in cube 'Issues:”

CASE WHEN [Issue].CurrentMember IS [Issue].DefaultMember
THEN
([Measures].[Issues created],
[Xray Tests created])
/ [Measures].[Xray Tests Xray Tests created]
END

Any help is appreciated.

Hi @SaadA,

To find out how many requirements are covered with tests and how many do not have any related test you might want to combine standard measures and dimensions with Xray specific measures and dimensions.

  • Standart measure “Issues created” and dimensions “Issue” and “Issue Type” will represent the total scope of requirements
  • Xray specific measure “Xray Tests created” and dimensions “Xray Requirement” will represent the count of covered requirements.

Now you can combine them in the calculation. I added the comments to the code so you could understand each part does:

CASE WHEN --condition to avoid dividing by zero
  ([Measures].[Issues created],
  [Issue Type].[Story]) <> 0
THEN --calculate the requirement coverage
  --count of covered requirement issues
  Sum(
    Filter(
      --go through all issues with type Story
      Descendants([Issue].CurrentHierarchyMember,[Issue].[Issue]),
      [Measures].[Issue type] = "Story" AND
      --check that issue is also the Xray Requirement with some assigned tests
      DefaultContext((
        [Measures].[Xray Tests created],
        [Xray Requirement].[Requirement].GetMemberByKey(
          [Issue].CurrentHierarchyMember.Key)
      )) > 0
    ), --sum up covered requirement issues
    ([Measures].[Issues created count],
    [Issue Type].[Story])
  )
  --divided by all requirement issue count
  /
  ([Measures].[Issues created count],
  [Issue Type].[Story])
END

More details on how to build calculations are described here:

Best,
Zane / support@eazyBI.com

Hello @zane.baranovska ,
Calculation for covered stories is not working correctly. I compared results from your suggestion with Xray Coverage report and your report shows less covered stories. I created “Tested by” issue property
[jira.customfield_is_tested_by]
name = “is tested by”
inward_link = “is tested by”
dimension = true
multiple_values = true
and number of records match Xray Coverage report.
Thanks
Boris

Hi,

Recently eazyBI released a new version 6.6, which includes several improvements for Xray data analysis, including a new measure “Xray Requirements created” that would show the count of all requirements issues covered and uncovered.
For more details, please see the documentation: Xray Test Management

Best,
Zane / support@eazyBI.com