Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rank and field value

Hi,

I have the following expression for getting top 5 rank number of customers by Amount. How I can modify this expression for getting rank and customer name?

=

aggr(if(Rank(total Sum({$<Account={[REVENUE - Total Revenue]},$(v_Period)>}  Amounts))<=5

          ,

Rank(Total Aggr(Sum({$<Account={[REVENUE - Total Revenue]},$(v_Period)>}  Amounts), Customer2,Country),'-')),Customer2,Country)

Now it looks like: 1,2,3,4,5

Should be: 1 - AAA, 2 - BBB, 3 - CCC, 4 - DDD, 5 - EEE

1 Solution

Accepted Solutions
Not applicable
Author

OK, I found the way:

=aggr(if(Rank(total Sum({$<Account={[REVENUE - Total Revenue]},$(v_Period)>}  Amounts))<=5

          ,

Rank(Total Aggr(Sum({$<Account={[REVENUE - Total Revenue]},$(v_Period)>}  Amounts), Customer2))),Customer2)

          & ' - ' & aggr(if(rank(Sum({$<Account={[REVENUE - Total Revenue]},$(v_Period)>}  Amounts))<=5,Customer2),Customer2)

View solution in original post

1 Reply
Not applicable
Author

OK, I found the way:

=aggr(if(Rank(total Sum({$<Account={[REVENUE - Total Revenue]},$(v_Period)>}  Amounts))<=5

          ,

Rank(Total Aggr(Sum({$<Account={[REVENUE - Total Revenue]},$(v_Period)>}  Amounts), Customer2))),Customer2)

          & ' - ' & aggr(if(rank(Sum({$<Account={[REVENUE - Total Revenue]},$(v_Period)>}  Amounts))<=5,Customer2),Customer2)