5 Replies Latest reply: Apr 6, 2017 1:33 AM by Vineeth Pujari RSS

    Multiple Averages Problem

    Erick Dameron

      Hi Experts!

       

      I have 5 flags for 5 fields that rate timeliness of service.

      IF(A - Today()>0,1,0) AS ATimeFlag,

      IF(B - Today()>0,1,0) AS BTimeFlag

      IF(C - Today()>0,1,0) AS CTimeFlag

      IF(D - Today()>0,1,0) AS DTimeFlag

      IF(E - Today()>0,1,0) AS ETimeFlag

       

      When I create a table it looks like this:

      Type%Expression
      A77%AVG(ATimeFlag)
      B94%AVG(BTimeFlag)
      C71%AVG(CTimeFlag)
      D90%AVG(DTimeFlag)
      E85%AVG(ETimeFlag)

       

      Now what i need to do is Average all the percentages from the table above which should give me a result of 83%.

       

      I tried:

      AVG(AGGR({$<ATimeFlag,BTimeFlag,CTimeFlag,DTimeFlag,ETimeFlag={1}>}COUNT(distinct Id),service))

      But didn't work.

       

      PS. I still haven't fully wrapped my head around AGGR().

       

      Any thoughts appreciated!