# Not working - Need to create a Calculated Field in Measures to filter out Sub Tasks based on condition

**URL:** <https://community.eazybi.com/t/not-working-need-to-create-a-calculated-field-in-measures-to-filter-out-sub-tasks-based-on-condition/17388>\
**Category:** Questions & Answers\
**Created:** [June 5, 2024, 5:19am UTC](https://community.eazybi.com/t/not-working-need-to-create-a-calculated-field-in-measures-to-filter-out-sub-tasks-based-on-condition/17388 "2024-06-05T05:19:07Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [July 3, 2024, 1:18pm UTC](https://community.eazybi.com/t/not-working-need-to-create-a-calculated-field-in-measures-to-filter-out-sub-tasks-based-on-condition/17388/2 "2024-07-03T13:18:20Z")

</div>

Hi @vibhutiverma,

Labels are multi-selection fields, and filtering issues **without** specific labels might give false results as the issue might have some other label that is allowed. When eazyBI checks on a label (or any other multi-value field), each label (value) is considered independently from other labels (values) assigned to the issue.

The best approach would be to create a JavaScipr calculated field that sorts issues by valid and invalid labels during data import. See the documentation for more details on how to create JavaScript calculated fields for an eazyBI account: [Account specific calculated fields](https://docs.eazybi.com/eazybi/data-import/data-from-jira/javascript-calculated-custom-fields/account-specific-calculated-fields)

The JavaScript code for grouping issues by labels might look like this:

```auto
// get the labels array from the issue fields
const labels = issue.fields.labels || [];
// list the target labels you are looking for
const targetLabels = ['data-validation','InvalidSheetNames','InvalidSheetStatusValue','InvalidSheetsMapping','FileUnlockError','FileExtensionError','NoWorksheetsLoadedError','Unidentified_repository_ID','MissingWorksheetsError'];

// check if any labels assigned
if (labels.length === 0) {
  return "invalid labels";
}

// Check if any of the issue's labels match the target labels
if ( labels.some(label => targetLabels.includes(label)) ) {
  return "invalid labels";
}
else {
  return "valid labels"
}

```

The field configuration as in picture below

 ![eazyBI calcauted field for labels](https://community.eazybi.com/uploads/default/original/2X/a/a08ff0c039ffab67b59035d27cd6af86bb2b95a2.png)

While creating the calauted field, **validate** it on **individual issues** to see if it gives expected resuls or it requires any adjustments. You can use **AI assistant** to help modifying the code (AI assistants are avaialbel on Cloud)

When you have a imported the new dimension to group issue by labels, you can use a **tuple** expressions to see issues in one or another group of labels (see documentation for more details: [Calculated measures](https://docs.eazybi.com/eazybi/analyze-and-visualize/calculated-measures-and-members/calculated-measures#Calculatedmeasures-Tupleexpression))

See related community posts on how to filter data by labels:

> [@Multi labels dimension table](https://community.eazybi.com/t/multi-labels-dimension-table/6276/2):
>
> Hi @Aiden, I understand that you would like to check on label combinations. In this case, you might want to import all applied label combinations as dimension members. If you have a significant issue amount, this option will work faster and do not require custom calculations. Go to eazyBI advanced settings and add the JavaScript calculated custom field for creating new dimension “Label combinations.” [jira.customfield\_eazybilabels] name = "Label combinations" data\_type = "string" dimension…

> [@Story points by label, excluding/including other labels](https://community.eazybi.com/t/story-points-by-label-excluding-including-other-labels/3188):
>
> I have two labels : BE, FE. Some tickets have both and some have one or the other. I need to slice and dice those story points in several ways. The measure Story Points Due will give me a total of story points for all stories that have the BE label (including those that are also labeled FE) and vice versa. I also need : a total of story points due for stories that have the BE label that DO NOT have the FE label. a total of story points due for only stories that have both FE and BE labels. …

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

---

_[View the full topic](https://community.eazybi.com/t/not-working-need-to-create-a-calculated-field-in-measures-to-filter-out-sub-tasks-based-on-condition/17388)._
