3 Replies Latest reply: Sep 14, 2015 11:37 PM by Digvijay Singh RSS

    number of months in a variable

    Rajender Thadakamadla

      HI All,

      Thanks for your time ;

       

      do we have a function which returns the number of months from given two dates

       

      I have to divide an expression with the months remaining in fiscal year

       

      LET  vFYEnding = DATE('03/31/2016','MM/DD/YYYY');
      LET vLastMonth = DATE(FLOOR(MONTHEND(ADDMONTHS(TODAY(),-1))),'MM/DD/YYYY');

      LET vNoOfMonths =   $(vLastMonth) - $(vFYEnding);     - this is giving me 8 instead of 7

       

       

      my fiscal year ending is 31 March 2016 - as of August I have 7 months remaining; as of sep 6 months

       

       

       

      my expression  - I need to replace 7 with the variable so that it is dynamic

       

      SUM (TCost) + (AVG(TCost) * 7 )

       

      Thanks for your time,

      Rj