2 Replies Latest reply: Feb 7, 2013 8:53 AM by dbuijsman RSS

    AVG of the first dates of the selection

      Hi,

       

       

      Im making an applications with different tables with many data. Lets look at his example what causes the trouble (This is just an example, with dummy data to make the problem clear):

       

      IDDD_AANVRDD_AFDOENING
      11-1-20014-1-2001
      14-1-20018-1-2001
      18-1-200118-1-2001
      118-1-200123-1-2001
      21-1-20013-1-2001
      23-1-20018-1-2001
      28-1-200118-1-2001
      218-1-200121-1-2001
      31-2-20014-2-2001
      34-2-20018-2-2001
      38-2-200118-2-2001

       

      I want to take the AVG of the amount of days between the begin and end dates of the ID's, but only from the first begin and end date.  So far i have this expression:

       

      AVG(if(DD_AFDOENING >= DD_AANVR, DD_AFDOENING - DD_AANVR))'

       

      Does somebody know how i can solve this?