5 Replies Latest reply: Aug 15, 2017 1:03 AM by susant Kumar swain RSS

    Optimize Aggr() Calculation

    Nicole Smith

      I'm currently writing a calculation that needs to count the number of Payers that have a Balance greater than 0 for a particular month.  The Balance is a sum of everything in the field Balance up to that month.

       

      This calculation returns the correct information, but it is much too slow to actually use (the chart takes about 5 minutes to calculate when using this): sum(aggr(if(sum(Balance)>0, 1, 0), Payer, Month))

       

      Does anybody know of a faster calculation that I could replace this with?  (I am thinking that the slowness is coming from the if statement inside of the aggr() because if I take the if statement out, it runs much faster, but it doesn't return the correct information.)

       

      Any help is much appreciated!  Thanks in advance!