Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum of rank

Hello everyone,

I use rank function to obtain a top 5 of my exportation. Then I want sum total exportation of this top 5 but i don't have sucess. Indeed, in each of my table, I obtain only total of product but I want total of exportation of TOP 5.

Do you have any idea to help me ?

Thanks in advance !

Best regards,

Salim

1 Solution

Accepted Solutions
OmarBenSalem

This what I've done with a sample app I have,

Capture.PNG

See the attached app

Now, stalwar1‌, the field is yours

View solution in original post

9 Replies
OmarBenSalem

Can you post an image of what you have?

your measure?

And what you want to calculate and where?

Or even better, can you put your sample qvf file to work with?

Thanks

Not applicable
Author

I use this formula, but she return nothing :

Aggr(Sum({<nom_Mesure={exp}>} valeur),

if(rank(if(((sum({<nom_Mesure={exp}>} valeur)/sum({<nom_Mesure={exp}>}total<nom_Du_Pays> valeur))*100)<=1,

((sum({<nom_Mesure={exp}>} valeur)/sum({<nom_Mesure={exp}>}total<nom_Du_Pays> valeur))*100)))<=5,

code_Produit))

OmarBenSalem

Can you please attach your QVF file Salim?

A sample one? only containing this table to work with?

And explain exactly what do you want to do?

Is it something like this?

First table: Customers and their sales

second table, only customers having the top 5 sales and the total of the top 5 :

Capture.PNG

Not applicable
Author

It's the windows named "one" and the measure named "Exp/pop" of the table. Before, my formula calculated total  exportation of one country in relation with population of this country. But now, I want calculate only the value total of the export of the top 5 for one country.

Not applicable
Author

Yes, I want this but I want total in each line.

Not applicable
Author

Thanks for you sample, I success but do you know if I can put this formula in variable ?

Sum(total Aggr(if(rank(if(((sum({<nom_Mesure={exp}>} valeur)/sum({<nom_Mesure={exp}>}total<nom_Du_Pays> valeur))*100)<=1,

((sum({<nom_Mesure={exp}>} valeur)/sum({<nom_Mesure={exp}>}total<nom_Du_Pays> valeur))*100)))<=5,

sum({<nom_Mesure={exp}>} valeur)), code_Produit))

Thanks again

OmarBenSalem

This what I've done with a sample app I have,

Capture.PNG

See the attached app

Now, stalwar1‌, the field is yours

OmarBenSalem

Salim,

If you want to see the top 5 exporting products by country; why don't you just create a pivot table: with :

dimension 1 : country

dimension 2 : produit (and limit it to the 5 first)

measure: Sum({<, nom_Mesure={exp}>}valeur)

Capture.PNG

Not applicable
Author

I do it this in first, but my problem it's I wished the Top N values of exp inferior(or superior) at X%. So it's not working fine like with rank function.