4 Replies Latest reply on Oct 17, 2016 5:04 AM by Łukasz Majewski

    is this a bug of table calculation function "Windows_avg()"?

    Kevin Meng

      Hi,

        I just fixed a issue caused by "windows_avg()", in my report, i want to get the past 6 month average sales units, i created a calculated field like below:

       

      windows_avg(sum(sales_units),-5,0)

       

      it looks good, but when i check it , found the average number is higher than "correct average", eventually, i found this caused by empty sales units in past 6 month. e.g.:

      from Jan to Jun, sales units are 3,3,(empty) ,12,(empty), empty.  "windows_avg" will show 6( (3+3+12)/3 ), what i expected value is 3( (3+3+12)/6),.  so i have to replace the calculated field like below to get right value:

       

      windows_sum(sun(sales_units),-5,0)/6

       

       

       

      you can see here the empty record caused issue, because "windows_avg" use below formula: (3+3+12)/3= 6, the divisor 3 only count Non-empty values, ignored empty records.

       

      but from the description of "windows_avg", it didn't mentioned above situations, its name looks like it should generate correct average.

       

      is this a bug of "windows_avg"? 

       

      Thanks,

       

      Kevin