4 Replies Latest reply: Nov 12, 2016 11:03 AM by Deepanshu Chamoli RSS

    Calculate two year gap

    Deepanshu Chamoli

      Hello All

       

      Please help me in the below query. I want to create a variable which calculates two year gap from today’s date.

      I have created as below:

       

      DATE(IF(ROUND(YEAREND(TODAY())-YearStart(TODAY()))= 365, MONTHSTART(TODAY())-730, MONTHSTART(TODAY())-731))

       

      The issue in that code is when the New Year starts i.e. 2017. The above formula fails as the difference between the year end data & year start date for 2017 is 365. Thus if I use above formula it will subtract 730 days.

       

      01-01-2017 – 730 = 02-01-2015

       

      But I want 01-01-2015.

       

      Please help me to rectify my mistake

       

      Thanks

      DC