Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Read about the latest Qlik Community enhancements on the Community News blog!
cancel
Showing results for 
Search instead for 
Did you mean: 
billbois
Creator
Creator

Get Name of Top Clients While Ignoring Selections

I need to get the names of the six top selling Clients.  This is easy to do in a chart, but I need each of them as either a variable or a text value.

If you take a look at the attached sample, the chart displays all the values all the time, even when you select a Client.  This is exactly what I want to happen.  However, I also want it to happen in the text boxes, and those go blank when you have one or more Clients selected. 

My statement for the first text box is:

 

=Aggr(If(Rank(Sum({$<Client=>}Sales))=1, Client), Client)

I would think this should display the #1 Client regardless of what's selected, but it doesn't.  Any ideas how I can rewrite it?

1 Solution

Accepted Solutions
swuehl
MVP
MVP

If you want the top Client no matter what you select, i.e. always show Chef, try

=only({1<Client = {"=Rank(sum({1}Sales))=1"}>} Client)

View solution in original post

5 Replies
swuehl
MVP
MVP

Hi Bill,

try

=only({<Client = {"=Rank(sum({<Client>}Sales))=1"}>} Client)

to get your top Client Chef.

billbois
Creator
Creator
Author

Wow, that's great!

But I knew I made my example too simple.  In my real app, I've got lots of a couple of other fields that could be selected and I want them ignored too.  I'm trying this but it's not quite right:

=only({<Client = {"=Rank(sum({<Client,Product=,Salesperson=>}Sales))=1"}>} Client)

billbois
Creator
Creator
Author

Answered my own question, and no, my stab at it doesn't work.  Here's a better sample file.  If you go in and select, say, Hats and Phil, it breaks.

Thanks again!

swuehl
MVP
MVP

If you want the top Client no matter what you select, i.e. always show Chef, try

=only({1<Client = {"=Rank(sum({1}Sales))=1"}>} Client)

View solution in original post

billbois
Creator
Creator
Author

Perfect!  I'm not sure why it works, but it does, so I'll have to research it and figure it out.

Thanks so much!