10 Replies Latest reply: Sep 11, 2018 5:23 AM by Avinash R

# set expression for ranking in Charts (top5 & bottom5)

Hi Experts,

I need to set expression in Charts and its ranking need to be shown as top5 and bottom5 together...

Thanks,

MAK.

• ###### Re: set expression for ranking in Charts (top5 & bottom5)

Try like this

=aggr(if(rank(sum(value))<=5 or rank(-sum(value))<=5,DIMENSION),DIMENSION)

• ###### Re: set expression for ranking in Charts (top5 & bottom5)

Hi Avinash,

I have tried the above expression but it does not work...

Thanks,

MAK.

• ###### Re: set expression for ranking in Charts (top5 & bottom5)

its working for me ..could share the expression how your trying ?

• ###### Re: set expression for ranking in Charts (top5 & bottom5)

aggr(if(rank(sum([Sales Target]))<=5 or rank(-sum([Sales Target]))<=5,Customer),Customer)

• ###### Re: set expression for ranking in Charts (top5 & bottom5)

Your trying this in the expression or dimension?

paste the above expression in the dimension and use sum([Sales Target]) in the expression that should work

• ###### Re: set expression for ranking in Charts (top5 & bottom5)

Under Dimension i have used field 'Customer' and the above expression i have used in Expression Editor (Dimension)

• ###### Re: set expression for ranking in Charts (top5 & bottom5)

na use create a calculated dimension

Dimesnion :

aggr(if(rank(sum([Sales Target]))<=5 or rank(-sum([Sales Target]))<=5,Customer),Customer)

https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/Dimensions/create-calculated-dimension.htm

Expression

sum([Sales Target])

• ###### Re: set expression for ranking in Charts (top5 & bottom5)

After applying the above expression in master item as dimension now it gives only top 5 customer, bottom 5 is missing...

• ###### Re: set expression for ranking in Charts (top5 & bottom5)

Hi Avinash,

Any Luck.? i have tried but i got top 5 customers only....need to get bottom 5 too.

thanks,

MAK.

• ###### Re: set expression for ranking in Charts (top5 & bottom5)

Currently  I don't have the access for Qliksense , I have tested the expression in Qlikview its working fine ....