# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

New Contributor

## Rank on multiple dimension

Hi All,

I have a straight table which ranks Top 10 products based on their sales, for products with equal sales I get same rank. When the ranks are same I want to rank those products based on their market sales.

I have the below table,

For example , Products P1,P2 and P5 have same rank 9, now I want to rank them 7,8 and 9 based on their market volume.

I am using the below expression,

If(Aggr(Num(Rank(Sum (Volume))),Product) = Aggr(Num(Rank(Sum (Volume))),Product),

Aggr(Num(Rank(Sum (Volume),4,1)),Market,Product),

Aggr(Num(Rank(Sum (Volume),4,1)),Product))

Which gives me the below result,

As you can see here, I get discontinuous rank.

Here the expression ranks the products based on their market volume but again starts the ranking from 1.

I want to keep my interactive sort active so as the user can understand how the sorting is taking place here and need a continuous ranking on the products.

Can someone suggest a solution on how can I achieve this scenario?

Regards,

Krutika

Tags (3)
3 Replies
MVP

## Re: Rank on multiple dimension

Would you be able to share a sample qvw to take a look at?

Contributor III

## Re: Rank on multiple dimension

Maybe you should try something like :

=Aggr(Num(Rank(TOTAL Sum (Volume),4)),Product,Market.Product)

New Contributor

## Re: Rank on multiple dimension

Hi Kevin,

The "Market.Product" is not working in the expression. It gave me no values. I couldn't understand exactly how is this expression working though.

Later I found a solution for this scenario in another discussion Ranking in case of tie breaker with respect to other metrics which worked perfectly for me.

Here they used the below expression for ranking the products,

=aggr(if(num(rank((sum(vol_units)+sum(YourSecondMatrics)/1E10),4,1))<=4,CUSTOMER),CUSTOMER)