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

# Straight Table, Expression construction

Hi,

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

Small example:

MyData:

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?

Nils

• ###### Re: Straight Table, Expression construction

If I understand the problem correctly, see attached application example and let me know if this is what you are looking for.

Result table in the application show sum of quantity when condition price >= (Avg Price – 1%) is true.

Regards,

Manoj

• ###### Re: Straight Table, Expression construction

Hi,

Thanks for you input.

This gives the correct answer, but I am looking for a more flexible solution - the full calculation made inside the expression.

The the calculation is made inside the expression, it will be possible to make selections on other fields on the records.

Best regards

Nils

• ###### Re: Straight Table, Expression construction

Here you go ...

• ###### Straight Table, Expression construction

Thank you :-)   Just what I was looking for