Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Straight Table, Expression construction

Hi,

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:

MyData:

Load * Inline [

MatCode, Amount, Quantity

"A", 10, 80,

"B", 20, 20,

"B", 5, 10

];

I create a Straight table:

Clipboard01.jpg

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

Nils

1 Solution

Accepted Solutions
Not applicable
Author

4 Replies
Not applicable
Author

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

Anonymous
Not applicable
Author

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

Not applicable
Author

Here you go ...

Anonymous
Not applicable
Author

Thank you 🙂   Just what I was looking for