Forum Discussion
Moving average based on prior N rows
- 6 years ago
The comma goes before the All(). Try doing just All('Normalized Calendar') instead (remove the column reference).
Regards,
Pat
- 6 years ago
StephaneMA colum type is whole number/decimal. Can you copy the table which i shared above and create the same measure (not calculated column) without any edits. Also share the snapshot.?
Thank you Pat,
I appreciate the quick reply.
When I enter the code as sent, I get the following:
If I add a coma before the ALL function, the error disappears but the result is not what I expect (see below)
Can you think of what is creating the issue?
Again, I really appreciate your assistance.
SL
The comma goes before the All(). Try doing just All('Normalized Calendar') instead (remove the column reference).
Regards,
Pat
- StephaneMA6 years agoFrequent Visitor
Sorry Pat,
Gave the same result
Prior 5 Weeks =VAR currentweeknumber =SELECTEDVALUE ( 'Normalized Calendar'[Normalized Week] )RETURNCALCULATE (AVERAGE (Opportunity[SL@ Opportunity Count]), ALL ('Normalized Calendar'),'Normalized Calendar'[Normalized Week] <= currentweeknumber,'Normalized Calendar'[Normalized Week] >= currentweeknumber - 5)BestSL- mahoneypat6 years ago
Microsoft Employee
Well that's unexpected (at least to me). Numbers look right beyond Week 5. Are there Opportunity data raws before Normalized Week 1? I will take a long again tomorrow, if someone else doesn't solve it first.
Regards,
Pat
- StephaneMA6 years agoFrequent Visitor
Pat,
thank you for the help......you had it all along....there must be something wrong with the original dataset which affected the result.
I appreciate your assistance!
Thank you again