Getting a count of a specific issue type that has a combination of labels

Hi EazyBI Community,

I have a report request that have multiple scenarios. It deals with combinations of multiple Labels.
So , here is the scenarios.
I want to get a count of a specific issue type that has a combination of labels.
So I need a count of how many “Issue Type = Enhancement” have.
Scenario 1. Label 1 and Label A
Scenario 2. Label 1 and Label B
Scenario 3. Label 2 and Label A
Scenario 4. Label 2 and Label B

The issue I am facing is Scenario 1 results include Scenario 3 and vice versa because they have Label A in common. Same with Scenario 2 and Scenario 4 which has Label B in common. How would I need to construct my Calculated Member for each of the Scenarios so that I get correct results specific to the labels in the respective scenarios? Or do I need to do some java script to create new dimension in the Label dimension? If so, how would it be constructed?

Thanks,
GA

Hi,

In this case, we would recommend using a Javascript code in eazyBI advanced settings to calculate a new issue field (during import) which you could import as a separate dimension, otherwise you will have to deal with complicated MDX code to calculate results as “Label” is a multi-value field and then report may become quite slow during calculation.

Try this code example:

[jira.customfield_sc]
name = "Scenario"
data_type = "string"
dimension = true
javascript_code = '''

var label1 = "Label 1";
var label2 = "Label A";
var label3 = "Label B";
var label4 = "Label 2";
var label = issue.fields.labels;

if(label){
  if (label.indexOf(label1) != -1 && 
     label.indexOf(label2) != -1)
    {     
      issue.fields.customfield_sc = "Scenario1";
    }
  if (label.indexOf(label1) != -1 && 
     label.indexOf(label3) != -1)
    {     
      issue.fields.customfield_sc = "Scenario2";
    }
  if (label.indexOf(label4) != -1 && 
     label.indexOf(label2) != -1)
    {     
      issue.fields.customfield_sc = "Scenario3";
    }
  if (label.indexOf(label4) != -1 && 
     label.indexOf(label3) != -1)
    {     
      issue.fields.customfield_sc = "Scenario4";
    }
};
''' 

Then you should be able to select the custom field in import options and later use as a filter in your reports.

Martins / eazyBI support

Hello,
I’m facing a very similar situation, but I’m not an admin, so I can’t use advanced settings.
I’ve been trying to define a new dimension or a new member based on several labels, but I can’t manage to get it.
In the Jira seach box, I’d put a query like:
issuetype = “User Story” AND labels = lavel_A AND (labels = label_B OR labels = label_C)

Is there a way to get that, without using advanced settings?

Thank you very much.

Hi,

It would be possible to calculate some results also using MDX functions when defining a new user-defined calculated measure in “Measures” dimension, but it may be very slow calculation as it should iterate through all imported issues to filter the right set.

NonZero(
  Count(
    Filter(
      Descendants([Issue].CurrentHierarchyMember,[Issue].[Issue]),
      [Measures].[Issue type] = "User Story"
      AND
      ([Measures].[Issues created],
      [Label].[Label_A]) > 0
      AND
      (
        ([Measures].[Issues created],
        [Label].[Label_B]) > 0
        OR
        ([Measures].[Issues created],
        [Label].[Label_C]) > 0
      )
    )
  )
)

This one should count issues based on created date timestamps.

Make sure that “Nonempty” cross join is enabled to avoid iterating through non-empty members.
If many issues imported in the cube, such calculation could raise a calculation timeout.
Especially if there are many rows and columns for your report in combination with page dimension filter with many values selected.

Note that “Label” is a multi-value field in Jira, therefore, the calculation is quite difficult from the query perspective. That is why would rather recommend using a Javascript in advanced settings to pre-calculate the field during import.

Martins / eazyBI support

Thanky very much.
I tried your suggestion, and it only takes a second or so, so its not bad in terms of performance.

I forgot to mention that I’d like the result as a Label or a member, so I can get the hours dedicated to those resulting issues, insted of just count them.

I’ve trying for a while now, but can’t get it. Any suggestion, please?

GuimRH

Hi,

In this case, it would still be a calcualted measures but just with a different formula.

NonZero(
Sum(
Filter(
Descendants([Issue].CurrentHierarchyMember,[Issue].[Issue]),
[Measures].[Issue type] = "User Story"
AND
(
[Measures].[Issues created],
[Label].[Label_A]
)>0
AND
(
(
[Measures].[Issues created],
[Label].[Label_B]
)>0
OR
(
[Measures].[Issues created],
[Label].[Label_C]
)>0
),
[Measures].[Hours spent]
)
)

But you can’t create a calculated member in “Label” dimension using this approach.
each displayed/selected Label dimension member usually “speaks” only about itself

Martins