Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all
How do I find which order has the max value?
OrderNo | Amount |
ABC | 125 |
BCD | 325 |
ABC | 541 |
DEF | 125 |
DEF | 135 |
ABC | 438 |
BCD | 223 |
EFG | 123 |
The dimension is against a SalesPerson
I thought that Max(Sum(aggr(Amount,OredrNo))) will do but it does not.
Thanks in advance
Josh
Create an expression :
FirstSortedValue( OrderNo , -Amount )
regards
JJ
I must have messed the question.
I am looking for the Max TOTAL value (sum) of an order not the Order that has the Max Value.
Your answer, for sure, will sure help me elsewhere.
Meanwhile, would you know how to extract the Max value for the orders
Maybe I miss something
Dimension : OrderNo
Expression : Max(Amount)
JJ
But I do not wish to show OrderNo in the dimension side.
Thanks
Did you try adding in the Sales person to the Aggr function?
Max(aggr(Sum(Amount),SalesPerson,OrderNo))
HEY THAT WORKED!
= Max(aggr(sum(Amount),OrderNo))
First of all you need to keep in mind that aggr() is defined as show below. This means that it must include an expression and then the dimensions over which the expression is calculated. If you are looking for the max value in your dimensions you simple right something like aggr(max(fieldName), dimension1, dimension2, dimension3)
aggr ( [ distinct | nodistinct ] [{set_expression}]expression {, dimension} )
Secondly you need to keep in mind that aggr will return a set of values, so if the aggregation expression does not return a single value you might need put the aggr() in a sum() for example to get the aggr set total sum.
The final answer to your question depends on what your data model looks like in relation to the chart you are trying to accomplish. You are probabaly loking for a construction like max(aggr(sum(fieldname), dimension1, dimension2, dimension3)) or aggr(max(fieldname), dimension1, dimension2, dimension3))
Thank you Toni. As per my previous reply to all the formula = Max(aggr(sum(Amount),OrderNo)) works correctly.
Your explanation that aggr() returns a set is valuable information that I should keep in mind.
PS I like your icon (the hat). Creative and unique.
Thanks
Hi Josh,
FirstSortedValue( OrderNo , -aggr(sum(Amount)) )