I'm getting negative value as a output,

Hi Team,

I have define new calculated members to get the age of tickets,but I’m getting negative value in output. Below is the query

NonZero(Avg(Filter(
Descendants([Issue].CurrentMember, [Issue].[Issue]),
[Measures].[Open issues] > 0 OR [Measures].[Issues closed] > 0),
Case when isempty([Measures].[Issue closed date])
then
Case when
DateBeforePeriodEnd(
[Measures].[Issue created date],
[Time].CurrentHierarchyMember) AND DateDiffWorkDays(
[Time].CurrentHierarchyMember.NextStartDate, Now())>0
then
DateDiffWorkDays([Measures].[Issue created date],
[Time].CurrentHierarchyMember.NextStartDate)
else
DateDiffWorkDays([Measures].[Issue created date],Now())
end
else
DateDiffWorkDays([Measures].[Issue created date],
[Measures].[Issue closed date])
end ))

I would like to know where I’m wrong / where i need to add up some stuff