2 Replies Latest reply on Feb 22, 2012 10:08 AM by seanoliver

    How to get around the non-aggregate/aggreate mix in an IF statement

      I have several categories of products and I need to calculate metrics using different criteria for each.  For example, I calculate the metric for Cat Toys like this:

      (sum([QTD Actuals])/sum([Full Quarter Target Growth]))*.3

       

      and the statement looks like:

       

      IF [Product Category]= "Cat Toys" THEN

           (sum([QTD Actuals])/sum([Full Quarter Target Growth]))*.3

      ELSEIF [Product Category]= "Dog Toys" THEN

           (sum([QTD Actuals])/sum([Full Quarter Target Growth]))*.5

      END

       

      This calcuation yields the 'cannot mix aggregate and non-aggregate comparisons or results' error.  What is the best way to handle this error?

       

      Thanks!