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): https://docs.eazybi.com/eazybijira/data-import/custom-fields/javascript-calculated-custom-fields.

There are Community posts on similar use cases:



Best,
Zane / support@eazyBI.com