6 Replies Latest reply on Jun 7, 2018 10:17 PM by Sohan Jawar

    Converting Negatives and 0 values to 0

    lalitha p

      Its is so weird with my calculation. I have a field with values like this.

      Name     Quantity     Type          Date

      XX            -8               1          07052018

      XX             8               2          07052018

      XX             0               3           07052018

      XX             -8             2           080502018

      XX              8              4            08052018

      XX              0              3            08052018



      I have this negative values to consider as 0 and 0 values as 0. So i am trying to create a calculation like this:

      If quantity <= 0 then 0

      else quantity end


      But this is giving me so weird results. It is converting negatives to 0 but 0 is somehow getting as 8 rather than 0. I have used round etc but didn't work for me.

      Then i used

      If sum(quantity) <= 0 then 0

      else sum(quantity) end


      or i have used (Currently i used this , because i do get only value as 8 or 0 or -8 mostly other values If any other values then fine i take it as other value only but my intention is if it is -ve and if it is 0 then 0 else quantity )

      so i consider this as this is giving me exact value what i expected...


      IF SUM([Quantity]) >= 8 THEN SUM([Quantity])

      ELSE 0 END


      It is giving me correct results. But i have a problem here, I need one more calculation which i cannot use this aggregation field there.


      Could anyone please help me here!