Do not double count issues that move projects

When SUMming measures, they often double count issues that have moved projects. Is there a way to avoid this? In short, I want the count, not the sum, but that seems to fundamentally change the way I need to write the custom measures. Here’s an example where I am interested in knowing the total number of epics for a given Fix Version:
image

However, when you Drill through issue, you can see that the count is overstated, in this case by one; again, this is due to the epic moving projects:

Here is the formula for Epic Count:

Sum(
  filter(
    Descendants([Issue].CurrentMember, [Issue].[Issue]),
    [Measures].[Issue type] = "Epic"
    AND
    [Measures].[Issue ACCOPS Work] > 0
  ),
  [Epic Fix Version].CurrentHierarchyMember
)

The measure Issue ACCOPS Work is created on import and not always used (meaning, the double counting of moved issues affects many different calculations). That said, here’s the code for it (in Advanced Settings), just in case:

[jira.customfield_eazybiaccopswork]
name = "ACCOPS Work"
data_type = "integer"
measure = true
javascript_code = '''
var projectComponent = "Account Operations";
var projectKey = "ACCOPS";
var result = null;
if (issue.fields.project.key == projectKey) {
result = 1;
} else if (issue.fields.components.forEach(function(component) {
  if (projectComponent.indexOf(component.name)>=0) {
	result = 1;
	}
}));
if (result) {
issue.fields.customfield_eazybiaccopswork = result;
}
'''

Any help would be greatly appreciated.

I think I solved my own problem :slight_smile:

That said, if anyone has any comments/feedback, I’d be happy to hear it.

The solution was to figure out how to use Issues created count within the results. By adding the last line below, it filters out the duplicates.

Sum(
  filter(
    Descendants([Issue].CurrentMember, [Issue].[Issue]),
    [Measures].[Issue type] = "Epic"
    AND
    [Measures].[Issue ACCOPS Work] > 0
  ),
  [Epic Fix Version].CurrentHierarchyMember
  - ([Measures].[Issues created] - [Measures].[Issues created count])
)

Hi,

A couple of comments on the last formula, as requested:

-) using the dimension members alone in the measure formulas implicitly joins the member with the Issues created, which is the default measure in the Issues data cube. That said, we can rewrite this part:

[Epic Fix Version].CurrentHierarchyMember
  - ([Measures].[Issues created] - [Measures].[Issues created count])

to the equivalent:

([Epic Fix Version].CurrentHierarchyMember,[Measures].[Issues created])
  - ([Measures].[Issues created] - [Measures].[Issues created count])

-) going further, referring to CurrentMember in this formula has no effect, since the current member is taken by default from the report context, so we can simplify the formula:

[Measures].[Issues created]
  - ([Measures].[Issues created] - [Measures].[Issues created count])

-) now we can do a bit of maths on that and reduce the expression to…

[Measures].[Issues created count]

So, we can see now your formula more clearly:

Sum(
  filter(
    Descendants([Issue].CurrentMember, [Issue].[Issue]),
    [Measures].[Issue type] = "Epic"
    AND
    [Measures].[Issue ACCOPS Work] > 0
  ),
 [Measures].[Issues created count]
)

One more comment is that this formula may have performance problems. It is possible to avoid the iteration through all issues if you create ACCOPS Work custom field as a dimension. The following formula would be much more efficient:

([Measures].[Issues created count],
[Issue type].[Epic],
[ACCOPS Work].[1])

You may wish to check how MDX tuples work: Tuple

Kindly,
Janis, eazyBI support

Thank you, Janis! Your explanation is very helpful. I will look into converting it to a Dimension as there are other use cases where I could see performance becoming an issue.