# New to QlikView

Discussion board where members can get started with QlikView.

Contributor III

## region wise

Hi all,

i want to show in pivot table top5 customers by each region

i have 3 regions  --- so in pivot table i want to show  total 15 customers each region 5 customers.

how can i do this?

Thanks

Sony

Tags (2)
1 Solution

Accepted Solutions
Honored Contributor II

## Re: region wise

Just copy the same expression and replace you expression for service and hardware

Refer the attachment.

Best Regards,
KC
16 Replies
Contributor III

## Re: region wise

Hi,

try this

=If(Rank(Sum(Sales), 1, 1) <= 5, Sum(Sales))

Hope this helps

Thanks,

Pooja

MVP

## Re: region wise

Try expression like:

If(Rank(Sum(Sales))<6, Sum(Sales))

Contributor III

## Re: region wise

thanks  but  i  have to measures

i cant put sum(sales)

dimensions:

customer

satge

Measure

sum({<type={'service'}>amount)

sum({<type={'Harware'}>amount)

the above am using  how can i do this?

MVP

## Re: region wise

Hi Sony, both answers (Pooja and Tresesco) seems to work. Just use your measure instead of sum(sales). That doesn't works?

Contributor III

## Re: region wise

not working

it is showing for each region 15 customers

i

MVP

## Re: region wise

I tried to reproduce it on Pooja's sample but only 5 customers per region are shown. Can you upload a sample or change the attached to show 15 customers by each region?

If(Rank(Sum(Sales), 4, 1) -> '4' to keep only one when there are different customers in the same rank.

Honored Contributor II

## Re: region wise

Hi Sony,

If you dont want to  modify the expression, then try this as dimension.

Replace customer with this expression:

=Aggr(If(Aggr(Rank(Sum(Sales),1,1),Region,Customer)<= 5,Customer),Region,Customer)

Exp: sum(Sales)

Br,

KC

Best Regards,
KC
Contributor III

## Re: region wise

Yeah. It won't work when you have two expressions, If the top 5 customers are different for both the type, then it will display top5 for type=service and top 5 customers for type=Harware.

If you just want top 5 for each region you have to use expression like this:

=If(Rank(sum( {<Type={'service','Harware'}>}amount)) <= 5, sum( {<Type={'service','Harware'}>}amount))

Thanks,

Pooja

Honored Contributor II

## Re: region wise

Also click on suppress null values.

But it is always recommended to modify the expressions rather using calculated dimensions. So the above mentioned solutions are more optimized

Br,

KC

Best Regards,
KC