7 Replies Latest reply: Aug 24, 2016 1:34 PM by Dyhessyca Correa RSS

    Calculate limited average for field's values

    Vladimir Komarov

      Hello,

       

      I am looking for non-trivial solution for my task:

       

      I do have data table that contains some values (people's daily counts) for multiple locations over time (for ~3 years)

      Screen Shot 2016-08-19 at 5.02.50 PM.png

      I need to calculate (for each day) the Average Traffic 10 days prior and 10 days after the particular date.

      It's easy to do in the chart:

      rangeavg(

        below(sum([Traffic Enters]), 0, 10),

        above(sum([Traffic Enters]), 1, 10)

      )


      But I need to do it in the script...


      Yes, there is a way using GROUP BY, FOR TO - NEXT, PEEK, etc approach...

      But I was hoping somebody could suggest a better and more elegant solution...


      Looking forward to your suggestions!


      Regards,

      Vlad