11 Replies Latest reply: Mar 5, 2018 3:26 PM by Sasidhar Parupudi RSS

    How to tune below expressions?

    Siva Boggarapu

      Hi,

       

      I have table with the below expressions. The below expressions are giving me bad performance while I am doing in selection

      Is there any better way we can modify the below table expressions?

       

      Unique Leads per Center:

      avg(aggr(count(distinct CallerNumber), ShopNumber))

       

      Lead Conversion %:

      count(distinct IF(InvoiceDateDT - CallDateDT >= 0 and InvoiceDateDT - CallDateDT <= $(vConversionLimit), CallerNumber)) / count(distinct CallerNumber)


      Conversion ARO:

      avg(

      aggr(

          max(

              IF(

                  InvoiceDateDT - CallDateDT >= 0 and InvoiceDateDT - CallDateDT <= $(vConversionLimit),

                      NetAmount

                  )

              )

          ,InvoiceHeaderId

          )

      )

       

      Thanks,

      Siva