1 Reply Latest reply on Apr 9, 2015 12:50 PM by Manoj Ramachandra

    How can get the right result for 'Last Day of Last completed quarter'.

    HAimanti Banerjee

      This is my query, giving me '12/30/2014' instead of 12/31/2014. I got the right result for quarter 3, that is september 30, 2014.

      IF DATEDIFF('day',[MaxDCDate],DATEADD('day',1, DATEADD('quarter', 1,DATEADD('day',-1,DATETRUNC('quarter',[MaxDCDate]))))) <5

      THEN DATEADD('quarter', 1,DATEADD('day',-1,DATETRUNC('quarter',[MaxDCDate])))

      ELSE DATEADD('day',-1,DATETRUNC('quarter',[MaxDCDate])) END

       

      where ,[MaxDCDate] is 2014-12-31

       

      It should be an automatic process of getting this date based on the last update of the database, which is 2014-12-31.

      If you provide any help will be great!!

       

      Thanks,

      Mitul