3 Replies Latest reply on Feb 21, 2018 2:30 AM by Abdul Rahman

    Urgent Help Needed: Please help me in how to get the date values from 1st feb 2015 till 31st Jan 2016 as periods 1 &  1st feb 2016 till 31st Jan 2017 as Periods 2 in calculated field

    suresh krishna

      Hi All,


      I have a requirement where I should show the sales quantity for last 36 months starting February 2015 till January 2018 in three different time periods. The time periods are as follows.






      Previous units period 1: feb 1 2015 till jan 31 2016

      Previous units period 2: feb 1 2016 till jan 31 2017

      current units pd 3: feb 1 2017 till jan 31 2018

      I used the below formula in the calculated field for getting Previous units period 1 and Previous unit period 2:


      Previous units period 1: IF [Calendar Daily Dt]>=
      DATEADD('month',-36,DATETRUNC('month',TODAY())) AND  [Calendar Daily
      Dt]<= DATEADD ('month',-25,DATETRUNC('month',DATEADD('month',1,TODAY()))-1)
      THEN [Calendar Daily Dt] END

      Previous unit period 2:IF [Calendar Daily
      Dt]>= DATEADD('month',-24,DATETRUNC('month',TODAY())) AND  [Calendar
      Daily Dt]<= DATEADD
      ('month',-13,DATETRUNC('month',DATEADD('month',1,TODAY()))-1) THEN [Calendar
      Daily Dt] END


      When I used the above formulas I am not getting the Last three days of January Month(29,30,31).It is getting cut in the report.


      Please help me with getting the date values till last day of the month.


      Thanks for your help in advance. I am using Tableau 10.2.2. version.