Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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:
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
Here you go ...
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
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
Here you go ...
Thank you 🙂 Just what I was looking for