Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Chellappan-Pillai
Contributor
Contributor

Display the Top Customer for the Category in Straight Table

I need to display the name of the Customer who has the highest SUM(SalesAmount).

image.png

 

Sample Attached.

Labels (1)
1 Solution

Accepted Solutions
rubenmarin

To return the first alphabetically:
Minstring(aggr(If(Rank(SUM(SalesAmount),1,1)=1, Name), EnglishProductName, Name))

To return the last alphabetically:
Maxstring(aggr(If(Rank(SUM(SalesAmount),1,1)=1, Name), EnglishProductName, Name))

View solution in original post

3 Replies
rubenmarin

Hi, you can try with:
Concat(aggr(If(Rank(SUM(SalesAmount),1,1)=1, Name), EnglishProductName, Name), ', ')
Chellappan-Pillai
Contributor
Contributor
Author

How to get only the first Customer, If there is multiple Customers with same Sum(SalesAmount)?
rubenmarin

To return the first alphabetically:
Minstring(aggr(If(Rank(SUM(SalesAmount),1,1)=1, Name), EnglishProductName, Name))

To return the last alphabetically:
Maxstring(aggr(If(Rank(SUM(SalesAmount),1,1)=1, Name), EnglishProductName, Name))