Calculating the number of comments

Hi,

I have a table for Issues Created by Reporters. I’m trying to make a new field that calculates the sum of the number of comments on all of those issues.
This is the script I’m using:

Sum(
[Reporter].CurrentMember,
[Measures].[Comments total]
)

I’m getting null cells with this formula, what’s wrong with it?

Thanks,
Yaniv

Hi,

Issue comments form Jira are not imported by default into eazyBI.

However, you could try using a Javascript code in your eazyBI advanced settings to define a custom field that will return the number of comments for an issue.

[jira.customfield_comments]
name = "Comments"
data_type = "integer"
measure = true
javascript_code = '''
if (issue.fields.comment && issue.fields.comment.comments ) {
	issue.fields.customfield_comments = issue.fields.comment.comments.length;
}
'''

Later you could import this custom field as a measure (via eazyBI import settings) that will create a new set of measures “Comments created”, “Comments resolved” etc. in your “Measures” dimension.

Then you could select the measure “Comments created” and it should return the total number of comments for an issue.

If you already have been using some add-on to calculate a custom field (which return the total number of comments) in Jira, you could simply try importing this custom field in eazyBI as a measure via eazyBI import settings (and avoid using Javascript in advanced settings).

That approach should return the total number of comments for each issue (regardless of which user commented)
Note that it will not return the number of comments that specific reporter made.

If you expect to calculate the number of comments per reporter, a different Javascript code should be used to calculate the number of comments each user made and then you should map this to “Reporter” dimension.

Kind regards,
Martins / eazyBI support

1 Like

Hi, do I need to setup the custom field in Jira first?
regards,
Matt

Hi @Matthew_Bushell,

No. There is no need to create a new custom field in Jira beforehand.
With JavaScript calculated custom fields you can create new custom fields only on the eazyBI side based on available issue data.

Best,
Zane / support@eazyBI.com

Hi both,
I expect to calculate the number of comments per reporter, so could you advise on the different Javascript code that should be used to calculate the number of comments each user made? Also, is it possible to count comments made to customer’s ONLY?

There are several JavaScript examples to count comments in the Community. You can start with those and then improve.

In any case, please read the documentation on how to define and validate the Javascript code before using it (those would be the first two paragraphs): JavaScript calculated custom fields.

There are Community posts on similar use cases:

Best,
Zane / support@eazyBI.com

I am trying to list the bug issues that are linked to story and see the count of linked bug in Done and count of done issue how can i achive this

@Yashwanthkumar_Shiva

Try exploring this demo report: Stories with Bugs details - Issues - eazyBI Demo Training - eazyBI

It shows linked bugs for each story and counts the linekd bugs in status done.
See the documentation page on issue link import: Import issue links

Martins / eazyBI support

Hey y’all

You can use this definition in advanced settings to count comments by periods of time they were added:

[jira.customfield_comments_byperiod]
name = "Comments by period"
data_type = "integer"
measure = true
multiple_dimensions = ["Time"]
javascript_code = '''
var commenta = new Array();
var allcomments = issue.fields.comment;
if (allcomments && allcomments.comments ) {
  var comments = issue.fields.comment.comments;
  for (var i = 0; i < comments.length; i++) {
      var comment = comments[i];
      commenta.push(comment.created.toString().substr(0,10) + ",1");
  }
  issue.fields.customfield_comments_byperiod = commenta.join("\n");
}
 '''

Martins / eazyBI

Hello @martins.vanags,
I am using this formula and getting the total count of comments.

[jira.customfield_comments]
name = "Comments"
data_type = "integer"
measure = true
javascript_code = '''
if (issue.fields.comment && issue.fields.comment.comments ) {
	issue.fields.customfield_comments = issue.fields.comment.comments.length;
}
'''

But I need count of comments only added by all assignees of the ticket.

Please help me to get this.

Regards,
Shivaprasad

Hi,

Assignees can change for the issue.
Do you want to count comments only by the current assignee of the ticket?

Martins / eazyBI staff

Hi @martins.vanags,

I need count of comments made by all assignees of the ticket.

Thank you.

@Shivaprasad_Hattarak

Try this Javascript to import comment counter against Assignee dimension members:

Martins / eazyBI

Hey @martins.vanags

I have a query regaring this

  1. dentify issues in your sprint with priority levels marked as “high” and “higher.”
  2. Sum up the story points for these high and higher priority issues to get the total.
  3. Calculate the total story points for all priority issues in the sprint.
  4. Divide the total of step 2 by the total from step 3 to find the ratio.

Thank you

Hi @Yashwanthkumar_Shiva

YOu could explore tuples when creating new calculated measures.

(
[Measures].[Sprint issues committed],
[Priority].[High]
)
+
(
[Measures].[Sprint issues committed],
[Priority].[Highest]
)

And then create another calcualted measure

for all priorities

(
[Measures].[Sprint issues committed],
[Priority].Currenthierarchy.DefaultMember
)

In step 4 you can create one more calculated measure for ratio where you can divide previous two calcualted measures.

Martins / eazyBI