14 Replies Latest reply: Nov 11, 2017 11:21 PM by Mohan Kumar RSS

    How to calculate the weighted Average for receivables?

    Mohan Kumar

      !Hi Qliker,

       

      I am calculating the weighted average of date difference by an amount for any dimensions. The formula I wanted to use is,

      Days = Sum((Date - Receipt Date) * Amount) / Total amount received.

       

      The expression I used is as follows,

      Avg(Aggr((sum(Aggr(((num(RECEIPT DATE) - num(Date))*AMOUNT),AMOUNT)) / TOTAL_AMOUNT),AMOUNT,%Dimension))

       

      There is a mismatch with the arrived value.

      After an excel workout, I found that, if the "AMOUNT" and "TOTAL_AMOUNT" are same the expression gives 0 as the value.

      I couldn't understand what went wrong to fix the expression to get a correct value.

       

      Thanks in advance !!

      Mohan