7 Replies Latest reply: Apr 4, 2016 8:44 AM by Gysbert Wassenaar RSS

    Using Rangesum for YTD calc

    Swetha More

      Hi Experts,

       

      Could someone help me debug this expression:

      sum(aggr(RangeSum(Above((Sum({$<[number]={'*SINV*'},[res_partner.name]={*}-{''},date_invoice={'>=$(=MonthStart(AddMonths(MonthYear),-(fMonth-1)))<$(=MonthEnd(MonthYear))'}>} [amount_untaxed])-

      Sum({$<[number]={'*SREF*'},[res_partner.name]={*}-{''},date_invoice={'>=$(=MonthStart(AddMonths(MonthYear),-(fMonth-1)))<$(=MonthEnd(MonthYear))'}>} [amount_untaxed])),0,fmonth-1)),MonthYear))

       

      I have created a master calendar and using that to calculate YTD.

       

      Thanks

      Swetha

        • Re: Using Rangesum for YTD calc
          Gysbert Wassenaar
          ,-(fMonth-1)

           

          fmonth-1

           

          I assume these two are supposed to be references to the same field or variable. Make sure to use the exact case sensitive name. fMonth and fmonth are two different names.


          Oh, and you can get rid of the AddMonths function. You're already using MonthStart and that accepts an offset parameter that works the same as the second parameter to AddMonths.