4 Replies Latest reply: Jan 28, 2012 5:46 PM by Nils Andersen RSS

    Straight Table, Expression construction

    Nils Andersen


      I have what looks to be a simple problem with a expression in a straight table.

      I might just miss the obvious – but please help.


      Small example:


      Load * Inline [

      MatCode, Amount, Quantity

      "A", 10, 80,

      "B", 20, 20,

      "B", 5, 10



      I create a Straight table:



      Dimension = MatCode

      Expression Total Amount = sum(Amount)

      Expression Total Quantity = sum(Quantity)

      Expression Avg Price = sum(Amount) / sum(Quantity)


      Now I want an expression that sum(Quantity), but only for the records where price >= (Avg Price – 1%)

      In this example I would expect the new expression to give this result: A = 80   and B = 20


      Any ideas?


      Thanks in advance