Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculate an average for the last 4 weeks

I have the following expression in order to calculate  CA from the begining of the year till yeasterday

=num(Sum({1< DateTest={"$(='>=' & Yearstart(AddYears(Today(), -1)) & '<' &  AddYears(Today(), -1))"}>} [CA]  ),'# ##0 ;-# ##0 ')

How to calculate CA average for the last 4 weeks. starting from today()-2

8 Replies
Chanty4u
MVP
MVP

sunny_talwar

Is this a rolling average you are calculating in a chart? or are you calculating this in a text box object? A sample with expected output will be helpful to resolve your issue

jonathandienst
Partner - Champion III
Partner - Champion III

Something like

Sum({1< DateTest={">=$(=Date(Today() - 28)) <$(=Today())"}>} [CA])

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

try like this?

I am assuming your DateTest is in this format "DD/MM/YYYY"

=Sum({<DateTest={">=$(=date(WeekStart(max(DateTest),-3),'DD/MM/YYYY'))<=$(=date(WeekStart(max(DateTest)),'DD/MM/YYYY'))"}  [CA])

Anonymous
Not applicable
Author

Not applicable
Author

Like this

Sum({1< DateTest={">=$(=Date(YearStart(Today()),'DD/MM/YYYY')) <=$(=Date(Today()-1,'DD/MM/YYYY'))"}>}[CA])



change the date format according to your  DateTest field date format..

Not applicable
Author

Hi Bala,

Thanks for the correction. But I have written expression   for

calculation  CA from the beginning of the year till yesterday

Not applicable
Author

Hi


expression for calculating  CA average for the last 4 weeks. starting from today()-2


Sum({1< DateTest={">=$(=Date(Weekstart(Today()-2,-4),'DD/MM/YYYY')) <=$(=Date(Today()-2,'DD/MM/YYYY'))"} >}

[CA])