# Filter "Xray Requirement" by labels

**URL:** <https://community.eazybi.com/t/filter-xray-requirement-by-labels/8796>\
**Category:** Questions & Answers\
**Tags:** mdx, xray\
**Created:** [February 9, 2022, 2:34pm UTC](https://community.eazybi.com/t/filter-xray-requirement-by-labels/8796 "2022-02-09T14:34:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fred.M](https://community.eazybi.com/letter_avatar_proxy/v4/letter/f/9f8e36/32.png) [@Fred.M](https://community.eazybi.com/u/Fred.M)\
**Post date:** [February 9, 2022, 2:34pm UTC](https://community.eazybi.com/t/filter-xray-requirement-by-labels/8796/1 "2022-02-09T14:34:51Z")

</div>

Hello,  
I would like to filter **“Xray Requirement”** by labels.

Any idea?  
Thanks in advance!  
Regards

---

<div class="post-metadata">

**Author:** ![zane.baranovska](https://community.eazybi.com/user_avatar/community.eazybi.com/zane.baranovska/32/7209_2.png) [@zane.baranovska](https://community.eazybi.com/u/zane.baranovska)\
**Post date:** [February 11, 2022, 7:22am UTC](https://community.eazybi.com/t/filter-xray-requirement-by-labels/8796/2 "2022-02-11T07:22:53Z")

</div>

Hi @Fred.M,

The measure is the core element of the report and defines how dimensions are related to each other.  
“Label” dimension group data by labels assigned to **Test Execution** or **Test** issues when used with Xray specific measures in the report (Xray Test Runs, Xray Tests created, etc.): [Xray Test Management](https://docs.eazybi.com/eazybi/data-import/data-from-jira-apps/xray-test-management#XrayTestManagement-XrayMeasures)

However, all Xray Requirements are also in the “Issue” dimension, and you can tap in it to retrieve any issue property or switch the report’s context.

You can create a **new calculated measure** (in the Measures) to show the label of Xray  
Requirement issue. For more details, read described example in the documentation: [Xray Test Management - Properties](https://docs.eazybi.com/eazybi/data-import/data-from-jira-apps/xray-test-management#XrayTestManagement-Properties).

The expression might look like this:

```auto
[Xray Requirement].CurrentHierarchyMember.get('Labels')

```

In the report, add the Xray Requirement label on columns and **filter rows** matching label name.

 ![Xray Requirement lable](https://community.eazybi.com/uploads/default/original/2X/f/f12cbb482a295ab2bbb604da690539b08cc1755c.png)

The alternative solution is to **redefine a relation** between “Label” and “Xray Requirement” dimensions. When changing the context this way, **all report measures should be adjusted** and replaced with calculated measures to work with the “Label” dimension in a new way.  
The logic for calculation is to go through all “Xray Requirement” issues and check each issue first from Xray perspective (has any test runs or created tests) and then from “Issue” dimension perspective (is created with a selected label).  
For example, you can rewrite “Xray Tests created” measure to use Lable dimension through Xray requirement like this:

```auto
--Tests created filtering by Xray Requirement label
Sum(
  --go through set of all Xray Requirements
  Filter(
    DescendantsSet([Xray Requirement].CurrentMember,[Xray Requirement].[Requirement]),
    -- check on requirement label from issue perspective
    DefaultContext((
      [Measures].[Issues created],
      [Issue].[Issue].GetMemberByKey([Xray Requirement].CurrentMember.key),
      [Label].CurrentHierarchyMember
    )) > 0
  ),
  --aggregate created tests ignoring label of a Test
  ([Measures].[Xray Tests created],
  [Label].CurrentHierarchy.DefaultMember)
)

```

Best,  
Zane / [support@eazyBI.com](mailto:support@eazyBI.com)
