3 Replies Latest reply: Apr 18, 2012 2:33 AM by Baru - RSS

    How to calculate last 3months distinct outlet covered

      Hi,

       

      I am trying to get last 3 months distinct outlet covered in text object.by month wise values showing correct,but i want to display last 3months outlet count.

       

      ex:- when i am selecting Jan month,i want to display Dec,Non,Oct outlent count.

       

      i am using this expression,

       

      =((count({$<YEAR = {$(=only(YEAR) - $(=if(only(MONTH) = 1, 1, 0)))}, MONTH = {$(=month(addmonths(MonthYear, -1)))},ClosingStock={'>0'}>}
      distinct IF(AHC_CallDate = MX_DATE, AHCHdr_Outlet_Code))) --------this is for Dec
      +
      (count({$<YEAR = {$(=only(YEAR) - $(=if(only(MONTH) <= 2, 1, 0)))}, MONTH = {$(=month(addmonths(MonthYear, -2)))},ClosingStock={'>0'}>}
      distinct IF(AHC_CallDate = MX_DATE, AHCHdr_Outlet_Code)))------------------this is for Nov
      +
      (count({$<YEAR = {$(=only(YEAR) - $(=if(only(MONTH) <= 3, 1, 0)))}, MONTH = {$(=month(addmonths(MonthYear, -3)))},ClosingStock={'>0'}>}
      distinct IF(AHC_CallDate = MX_DATE, AHCHdr_Outlet_Code))))-----------------this is for Oct

       

      by giving month wise it showing correct values.

      can any one having idea about this,pls help me.

       

      reg,

      ba