Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
data_RN
Creator
Creator

Syntax improvement question - Average of last measures

Hi All, 

I hope this is an easy one for a Friday, but I have tried this a few ways and haven't been able to figure it out.  I want the average score of the last few days.  I get the right answer with the formula below, but is there a more elegant way to set it up?

(sum({$<[Approval Date]={"$(=Date(Max(Date,3)))"}>}[Score Actual])+
sum({$<[Approval Date]={"$(=Date(Max(Date,4)))"}>}[Score Actual])+
sum({$<[Approval Date]={"$(=Date(Max(Date,5)))"}>}[Score Actual])+
sum({$<[Approval Date]={"$(=Date(Max(Date,6)))"}>}[Score Actual]))/4

Thanks as always!

 

1 Solution

Accepted Solutions
tm_burgers
Creator III
Creator III

I think that the below will work for you:

 

AVG(AGGR(nodistinct sum({<[Approval Date]={">=$(=Date(Max(Date,6)))<=$(=Date(Max(Date,3)))"}>} [Score Actual]),[Approval Date]))

View solution in original post

3 Replies
dplr-rn
Partner - Master III
Partner - Master III

how about something like below

sum({$<[Approval Date]={"<=$(=Date(Max(Date,3))) >=$(=Date(Max(Date,6)))"}>}[Score Actual]) / 4

tm_burgers
Creator III
Creator III

I think that the below will work for you:

 

AVG(AGGR(nodistinct sum({<[Approval Date]={">=$(=Date(Max(Date,6)))<=$(=Date(Max(Date,3)))"}>} [Score Actual]),[Approval Date]))

data_RN
Creator
Creator
Author

@tm_burgers that was it!

Thank you and Happy Friday!!!