3 Replies Latest reply on Nov 9, 2016 12:33 PM by Elle Morel

    cannot mix aggregate and non-aggregate comparisons or results in IF Functions

    Elle Morel

      I have a question abt calculated field -- If ([Parameter] = True and Today () >= Date ([orderDate]) + 30)  then SUM ([salesAmt1])  else sum([salesAmt2]) END -- it keeps giving "cannot mix aggregate and non-aggregate comparisons or results in IF Functions" error. How to fix it to make the SUM work when parameter is true and for orders more than 30 days old?

       

      Also, instead, if I use SUM (If ([Parameter] = True and Today () >= Date ([orderDate]) + 30)  then [salesAmt1] ELSEIF ([Parameter] = False and Today () >= Date ([orderDate]) + 30) THEN [salesAmt2] END)

       

      -- The above is valid but NO data is displayed (all blanks/Nulls) -- what's wrong either and how to show the SUM data?

       

      I am relatively new in this. Thanks a bunch for your inputs and expertise!!