9 Replies Latest reply: Apr 4, 2017 4:19 AM by Salim DERGHOUM

# 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 ?

Best regards,

Salim

• ###### Re: Sum of rank

Can you post an image of what you have?

And what you want to calculate and where?

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

Thanks

• ###### Re: Sum of rank

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))

• ###### Re: Sum of rank

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 :

• ###### Re: Sum of rank

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

• ###### Re: Sum of rank

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

• ###### Re: Sum of rank

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.

• ###### Re: Sum of rank

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

See the attached app

Now, stalwar1, the field is yours

• ###### Re: Sum of rank

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)

• ###### Re: Sum of rank

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.