Find average resolution days for bugs created only in the last 6 months

I am using the predefined formula “Average resolution days” to show the average resolution days for all the bugs in my project. However, I want to see this average only for bugs that are created in the last 6 months. How can I modify this formula ?

Current formula i see for “Average resolution days” is

CASE WHEN [Measures].[Issues resolved] > 0 THEN
[Measures].[Total resolution days] / [Measures].[Issues resolved]
END

I created a calculated member under Time and called it “Last 6 months” and used this formula
Aggregate(
{[Time].[Month].CurrentDateMember.Lag(5):
[Time].[Month].CurrentDateMember
})

But I am not able to figure out how can I get resolution days for only these bugs created for the past 6 months.

Hi @sunray2003
Welcome to eazyBI community!

In your described use it would be faster if you would filter issues by their properties isntead of using your Aggregated calculated member to find the resoluion days as this case requires going through the issue dimension members to find the right set of issues for average calculation.

Try creating a new calculated measure using this code:

NonZero(
Avg( --average function starts here
Filter(
Descendants([Issue].CurrentHierarchyMember,[Issue].[Issue]), --going through issues 
--function to find issues created in last 6 months
DateBetween(
[Issue].CurrentHierarchyMember.get('Created at'),
'6 months ago','today'
)
AND --checking if issue belongs to report context and was resolved in the report time period
DateInPeriod(
  [Issue].CurrentHierarchyMember.get('Resolved at'),
  [Time].CurrentHierarchyMember
)
AND
[Measures].[Issues resolved] > 0 
),
[Measures].[Total resolution days] --returning resolution days
)
)

Martins / eazyBI team