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

Get rank from table

Dear all,

I have loaded from excel the following file:

CountryCategoryCodeAmount
GR11.15
GR11.210

GR

22.115
GR22.220
US11.125
US11.230
US11.335
US22.140
US33.145
US33.250
US33.3100
US44.160

And I have created one multi box on which there is only the dimension of Country (GR,US,ES) and one pivot table chart object which calculates the averages of codes for each category (the country is selected from the user in the multi box) and looks like the following :

For Country = GR (selected from the multibox) it returns :

CategoryAverage
17,5
217,5
30
40

For Country = US (selected from the multibox) it returns :

CategoryAverage
130
240
365
460

As you can easily understand in this pivot I have added on the dimensions tab the "Category" dimension and on the expression tab I have added one definition which calculates the average of the Codes [ Avg (Amount) ].

I now want to add one column in this pivot which will calculate the rank of the country selected for each category and average. So the result will have to be the following:

For Country = GR (selected from the multibox) it returns :

CategoryAverageRank
17,52
217,52
302
402

For Country = US (selected from the multibox) it returns :

CategoryAverageRank
1301
2401
3651
4601

Can anyone help me on the second expression of the table pivot chart object which will calculate the rank ???

Thank you in advance

12 Replies
Not applicable
Author

Hi,

Please see file attached.

Regards

RL

Not applicable
Author

Dear Rahul Lakhina I use Qlik View Personal Edition x64 and I cant open the .qvw because I have exceeded the maximum number of document recoveries. Please could you send me just the expression of the new column on my pivot table chart object ?? Thank you in advance mr Lakhina.

Not applicable
Author

Create a Variable vRank = Aggr( Rank( Avg({<Country=>} Amount)),Country)

for expression use:

Only(Total $(vRank))

Hope that works for you.

Regards

RL

Not applicable
Author

Unfortunately it didnt work. There is only the minus sing "-" in each row.

Not applicable
Author

Do you have a Country selected?

Regards

RL

Not applicable
Author

You could also use this as an expression to direct the users towards the country:

If(isnull(GetFieldSelections(Country)),'Select Country', (Only(Total $(vRank))))

Not applicable
Author

Of course! The only change when I change the selection of the country is the number title of the column: Only(total X).

X is changing per country on the title only. On the next expression you sent me the only added is when no country is selected it shows the "Select country" string on the rows..

Not applicable
Author

Hey,

Could you possible send me your file to see what going on? That way i can trouble shoot it better.

Regards

R

Not applicable
Author

I have attached you also the Excel file from which i loaded the data

Regards