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

Aggr and Rank

I am slightly confused with two expressions as they produce the same result even though they look different:

Expression 1: rank(aggr(sum(Sale),Item)) - This makes more sense to me as my understanding says aggr() creates a virtual table and then Rank() is performed on that

Expression 2: aggr(rank(sum(Sale)),Item) - It produces the same result as above but how it is working? I am bit confused as rank() is embedded in aggr(). Could you please help me understand?

5 Replies
Chanty4u
MVP
MVP

simple on two  explnation

Rank

Agg function

Anonymous
Not applicable
Author

Hi,

Please check out:

Aggr() function and

How to use rank function?

These should help a bit

MK_QSL
MVP
MVP

You don't need Aggr here if you simple want Rank..

You can write
Rank(SUM(Sale),4)

But when you select Any single Item you will get Rank always 4.

So to get the Rank ignoring your Item selection, you can use below expression

Aggr(Num(Rank(Total Sum({<Item = >}Sale),4)),Item)

Not applicable
Author

Thanks for the pointers. I just finished reading them but still I am left with the same question...does the expression evaluation starts from within...that is rank(sum(Sale)) is computed first and then aggr() is performed on that...It looks like a dumb question but I am eager to learn it 

Not applicable
Author

Hi,

these two expressions gives the same result but the right way is to use is

if(aggr(rank(sum(sales))>1,item),item)