Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Ranking Problem

Hi everyone and thanks in advanced for your time.

I'm trying to do what I would have thought a basic sales analysis, however I haven't been able to get arround some ranking problems.

I'm trying to get a texbox (It doesen't HAVE to be a text box, but it would be better) to show me the name of my top X salesman (ranked by sales amount). In a second text box I need to see that persons top X products sold (again, ranked by sales amount). Since each salesman could hypothetically sell different products in order for each salesman top X products to appear the first condition should be if he/she actually sold those products.

I know the explanation might have been a bit fuzzy, so Im including both my .qvw file and my original data in .xlsx

Any tips will be appreciated!

Cheers,

FS

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Hi Francisco,

I tried to develop a solution, but in my App Carol is #2 instead of Julian

I used

= only({<Salesman= {"=rank(sum(Amount),Salesman) =1"}>} Salesman )

for top Salesman retrieval and

=firstsortedvalue({<Salesman= {"=rank(sum(Amount),Salesman) =1"}>} Product, -1 * aggr(sum(Amount), Salesman, Product),1)

for the Top product of the top Salesman.

For second, third, just adapt the magic numbers (the -1 in second argument to firstsortedvalue is for descending ordering).

Please check if this is what you want, if you have any questions, I'll be glad to answer.

Regards,

Stefan

View solution in original post

2 Replies
swuehl
MVP
MVP

Hi Francisco,

I tried to develop a solution, but in my App Carol is #2 instead of Julian

I used

= only({<Salesman= {"=rank(sum(Amount),Salesman) =1"}>} Salesman )

for top Salesman retrieval and

=firstsortedvalue({<Salesman= {"=rank(sum(Amount),Salesman) =1"}>} Product, -1 * aggr(sum(Amount), Salesman, Product),1)

for the Top product of the top Salesman.

For second, third, just adapt the magic numbers (the -1 in second argument to firstsortedvalue is for descending ordering).

Please check if this is what you want, if you have any questions, I'll be glad to answer.

Regards,

Stefan

Not applicable
Author

Worked like a charm! And you're correct on the Carol-Julian thing as well .

Thnks Stefan!