12 Replies Latest reply: Jan 8, 2014 9:54 AM by Neil Perkins RSS

    IF statement in an expression

      I am trying to wirte an IF statement in an expression to either Add or subtract sales and costs depeneding on whether the sales figure is a '+' or a '-'. my code so far is

       

       

      Sum(Aggr(If([Sales]='+',  Sum([Sales Amount (Actual)])-([InvoiceLine_UnitCost]*[Invoiced Quantity]) ,

               If(
      [Sales]='-', Sum([Sales Amount (Actual)])+([InvoiceLine_UnitCost]*[Invoiced Quantity])))))

       

      The [Sales] tag is an existing column in the chart.