3 Replies Latest reply: Mar 23, 2017 5:29 AM by Sunny Talwar RSS

    Count if dateA is before dateB (incl. variable)

    Benjamin Czech

      I have an expression that works well. What it does, is, it counts the invoices “Paid ontime” and the “Paid ontime” is already set during import.

       

      It looks like this:

       

      Count({$<[PAYMENTS.PAYMENT_PERFORMANCE] = {'Paid ontime'}>}DISTINCT([PAYMENTS.INVOICE_ID]))

       

      Now I am trying to do something similar but more enhanced.

       

      I want to count invoices where the payment date is before the due date including a tolerance which is a numeric value (variable) that can be set in a input box.

       

      I have tried it like this but something is not right.

       

      Count({$<[PAYMENTS.PAYMENT_DATE] = {>= Date(Date(Num(PAYMENTS.INVOICE_DUE_DATE)+v_ontime_tolerance)) }>}DISTINCT([PAYMENTS.INVOICE_ID]))

       

      Can anyone indicate what's wrong?

       

      Thanks,

      Benny