2 Replies Latest reply on Jun 17, 2016 6:48 AM by zibal jafri

    Calculated Field using contains

    zibal jafri

      Hello Everyone,

       

      I have an existing field [Months] with values as (January, February, March and April). I am trying to create a calculated field with the below code :

       

      If CONTAINS([Months], "April")

      THEN "Current"

      ELSEIF 

      CONTAINS([Months], "March")

      THEN "Last"

      ELSEIF

      CONTAINS([Months],"January") or CONTAINS([Months], "February") or CONTAINS([Months], "March")

      then

      "Quarter"

      END

       

      Now when I am trying to map another existing Field [Total Hours] to the calculated filed, I am getting accurate results for "Current" and "Last" but for "Quarter" I am not getting correct results. For "Quarters" it is just calculating the total hours for January and February and neglecting the total hours in "March". Can anyone tell me what is the problem ?

       

      Regards,

      Zibal