4 Replies Latest reply on Sep 20, 2018 10:46 AM by John Salazar

    How to calculate proportion of values in a field that fall within a range

    John Salazar

      Hello,

       

      I am trying to create a stacked area chart that shows percentages of values in a field that fall within a range.  For example, I am trying to calculate one segment of the area chart like this:

       

      IF [Turbulence] >= -1 AND [Turbulence] <= -0.5

      THEN 1/COUNT([Turbulence])

      ELSE 0

      END

       

      I would then SUM() the resulting calculated value to get the count of Turbulence values that fall within the range.

       

      However, I get the following error "Cannot mix aggregate and non-aggregate comparisons or results in 'IF' expressions".

       

      How can I count up the number of turbulence values that fall within the range and then divide it by the total number of turbulence values?

       

      Thanks,

      John