How to create a measure that counts issues that contain two defined labels?

Hi,

I have jira issues that contain several different labels, lets name them label “A”, label “B” and label “C”. Now I want to create a measure that counts all created issues that contain both “A” and “B” as labels. How can I do that? I would appreciate any hint on how to solve this as a calculated measure. Thank you!

Hi @Chris1,

Labels are multi-value fields, and eazyBI check is an issue (work item) has any of the selected labels when you filter the report by Label A and Label B.

There are a couple of approaches to count issues that contain both label “A” and label “B”:

  1. Calculated measure with fixed label values
    In Measures, define a new calculated measure that would go through all imported issues and check if they have label A and also label B. For the calcaution use funtions Count() and Filter() like this:

    NonZero(Count(
        Filter(
          --itearte through all issues
          Descendants([Issue].CurrentMember, [Issue].[Issue]),
          -- for each issue check it has lable A AND label B
          ([Measures].[Issues created],
          [Label].[A]) > 0
          AND
          ([Measures].[Issues created],
          [Label].[B]) > 0
        )
    ))
    

    More details on calculated measures and how to create them are described in the documentation: Calculated measures

  2. Calculated measure to count issues matching selected label set
    This calculation also iterates through all issues in the eazyBI cube, but is more flexible and responds to selected label combinations on report pages.

    NonZero(Count(
      Filter(
        DescendantsSet([Issue].CurrentMember,[Issue].[Issue]),
        --selected label count
        CalculatedChildrenSet([Label].CurrentHierarchyMember).Count
          --matches the count of labels issue has from selection
          = [Measures].[Issues created]
      )
    ))
    

    See the details in this community post: **Need guidance on implementing AND logic for multiple Labels in an eazyBI report so the results match Jira filtering behavior without impacting the existing report.** - #2 by zane.baranovska

  3. New dimension to represent label combinations
    For better performance (especially with large datasets), the recommended approach is to import a pre-calculated “Label combinations” dimension. This avoids costly runtime iteration through all issues. See the community post for setup instructions: Multi labels dimension table - #2 by zane.baranovska

Best,
Zane / support@eazyBI.com

Thank you Zane, option 1 works for me.