2 Replies Latest reply on Sep 15, 2016 11:40 PM by Shriram Saxena

    IF calculation with aggregate functions

    amulya.sharma
      ABUA
      10Negative
      11Negative
      13Positive
      25Negative
      22Positive

       

      For this table, I want to calculate %UA Negative such that when A = B then count all the Negatives in the UA column and divide that by total number of results where A = B.

      So for A=1 and B=1, %UA Negative = 1/2 = 0.5

       

      I tried creating a calculated field:

       

      IF [A] = [B] THEN
      SUM(IF[UA] = 'Negative' THEN 1 ElSE 0 END)/COUNT([UA]) END

       

      Getting the error: Cannot mix aggregate and non-aggregate comparisons or results in 'IF' expression