5 Replies Latest reply on May 23, 2016 8:00 AM by Joe Oppelt

    Please help me write this simple If function (Workbook Attached)

    rabeeh.elhussein

      Hi,

       

      I am writing a simple case formula to calculate the margin ..

       

      CASE [CURRENCY] WHEN "USD"

      THEN

      SUM([TOTAL SALES]-[TOTAL COST])/SUM([TOTAL SALES])

      WHEN "EURO"

      THEN

      SUM([TOTAL SALES IN EUROS] - [TOTAL COST])/SUM([TOTAL SALES])

      END

       

      i am getting the error: can't mix between aggregate and non aggregate ..

       

      I tried to change  to

       

      CASE ATTR([CURRENCY]) WHEN 'USD' ...

       

      but the results are not correct ..

       

      what's the right formula ? please help.

       

      I've attached a sample workbook

       

      Message was edited by: Rabeeh El Hussein