Average amount of resolved issues with date filter

Hi Community!

I’m trying to calculate the average amount of resolved issues from Example 2 (Avg):

--test avg debug (new)
Avg(
  {[Time.Weekly].[Week].CurrentDateMember.Lag(3): 
   [Time.Weekly].[Week].CurrentDateMember.PrevMember},
  CoalesceEmpty(
  ([Measures].[Issues resolved],[Time].DefaultMember),
   0)
)

, but with additional Date filter. I see that my results not applied with that filter, how can I fix this?

Thanks in advance!

Hi,

the CurrentDateMember function is fixed to the current week in your formula.
There is another formula that refers to the respective time member from the report context. Please, try the formula by replacing the function with CurrentMember.

This function will not work at the “Last 26 weeks” member level, so we should safeguard the code from trying to find “previous” members from the “Last 26 weeks”:

CASE WHEN 
[Time].CurrentHierarchyMember.Level.Name="Week"
THEN
Avg(
  {[Time.Weekly].[Week].CurrentMember.Lag(3): 
   [Time.Weekly].[Week].CurrentMember.PrevMember},

  CoalesceEmpty(([Measures].[Issues resolved]),0)
)
END

Kindly,
Janis, eazyBI support