# QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
Not applicable

## Ranking based on deviation from zero

Dear Experts,

We are having a business requirement where we want to rank the values based on deviation from zero.

the value which is having lowest positive difference from zero will get the rank 1.

Next postitive deviation will get rank 2. Then lowest negative difference will get rank 3 and so on.

For Example

 Percentage Rank 10 2 5 1 -2 3 -5 4

A quick response will be appreciated.

Regards,

Prashant Karanjgaonkar

1 Solution

Accepted Solutions
Highlighted
Not applicable

## Re: Ranking based on deviation from zero

Hi

Please use following expression

Rank((vMaxValue-VALUE)*(if(VALUE>=0,1,-1)))

8 Replies
Highlighted
Esteemed Contributor III

## Re: Ranking based on deviation from zero

try

=Firstsortedvalue(percentage,Field)

Highlighted
Not applicable

## Re: Ranking based on deviation from zero

Hi,

thanks for quick reply.

Can you help with a test application.

Highlighted
Esteemed Contributor III

## Re: Ranking based on deviation from zero

simple example read below

FirstSortedValue()

Highlighted
Valued Contributor II

## Re: Ranking based on deviation from zero

May be use a hidden expression like below

If(Percentage> 0,100- Percentage, Percentage -100)

and try Rank(Column(1)) as the actual rank expression

Highlighted
Not applicable

## Re: Ranking based on deviation from zero

Hi

Please use following expression

Rank((vMaxValue-VALUE)*(if(VALUE>=0,1,-1)))

Highlighted
Not applicable

## Re: Ranking based on deviation from zero

Rank((vMaxValue-VALUE)*(if(VALUE>=0,1,-1)))

Highlighted
Contributor III

## Re: Ranking based on deviation from zero

Hi,

Try this you will get solution,

=aggr(rank(if(Percentage>0,\$(=max(Percentage))-Percentage,Percentage-\$(=max(Percentage)))),Percentage)

Regards,

Highlighted
Not applicable

## Re: Ranking based on deviation from zero

superbbbbbbbb Amit Dubey.

Also thanks to  Prashant ,for such type of problem statement

Amit dubey ,can provide one test application for this,if yes it is very helpful.