4 Replies Latest reply on Nov 6, 2018 12:30 AM by Raquel Garcia

    Sintaxis: How to create a Calculated Field for with multiple condition formulas?

    Raquel Garcia

      I work with data from a survey, which asks about the frequency with which 6 problems have been suffered. And I need to create a Calculated Field (E1_%) so that, when constructing a Parameter "Problem suffered", I can tell you that, if I choose Problem X (E1_Nca), I get the% of those who have never suffered,% who have suffered it occasionally and the% of those who suffer it constantly.




      The formula works for me when I put only 1 condition. For example, calculate the% of those who have never suffered it:

      SUM (IF ([E1_Nca]) = 1
      then ([Resp_pond]) END) / sum (IF ([E1_Nca]) <> 0 then ([Resp_pond]) END)



      But not when I put the three conditions together:


      SUM (IF ([E1_Nca]) = 1
      then ([Resp_pond]) END) / sum (IF ([E1_Nca]) <> 0 then ([Resp_pond]) END)

      SUM (IF ([E1_Nca]) = 2
      then ([Resp_pond]) END) / sum (IF ([E1_Nca]) <> 0 then ([Resp_pond]) END)

      SUM (IF ([E1_Nca]) = 3
      then ([Resp_pond]) END) / sum (IF ([E1_Nca]) <> 0 then ([Resp_pond]) END)

      What am I doing wrong?
      Please help.