# QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

## Sort values in a chart legend

Hello togehter,
i created a dimension with
=
IF(A >=1 and A<1.25,'iinteresting',

if(A>=1.25 and A<2.25,'empty',

if(A>=2.25 and A<3.25,'grandfather',

if(A>=3.25 and A<=4,'nearly'))))
My legend at the bar-chart shows the values at following order:
* nearly
* grandfather
* interesting
* empty
But i want that the legend shows the values like my formula. So i write the formula in the formula field at the sort register. but this doesn't work.Can anyone help me please? Thanks!
1 Solution

Accepted Solutions
Contributor III

## Re: Sort values in a chart legend

Hi,

You try using the dual function to sort you values.

IF(A >=1 and A<1.25,Dual('iinteresting',1),

if(A>=1.25 and A<2.25,Dual('empty',2),

if(A>=2.25 and A<3.25,Dual('grandfather',3),

if(A>=3.25 and A<=4,Dual('nearly',4)))))

Sort this dimension by numeric. Best way to do this is, create this as a column in back script and use the field in front end as show in this attached post.

Hope this helps you.

-Sridhar

4 Replies
Contributor III

## Re: Sort values in a chart legend

Hi,

You try using the dual function to sort you values.

IF(A >=1 and A<1.25,Dual('iinteresting',1),

if(A>=1.25 and A<2.25,Dual('empty',2),

if(A>=2.25 and A<3.25,Dual('grandfather',3),

if(A>=3.25 and A<=4,Dual('nearly',4)))))

Sort this dimension by numeric. Best way to do this is, create this as a column in back script and use the field in front end as show in this attached post.

Hope this helps you.

-Sridhar

Honored Contributor II

## Sort values in a chart legend

Hi,

Have you considered using Dual() function? Something like this...

=

IF(A >=1 and A<1.25, Dual('iinteresting', 1),

if(A>=1.25 and A<2.25, Dual('empty', 2),

if(A>=2.25 and A<3.25, Dual('grandfather', 3),

if(A>=3.25 and A<=4,Dual('nearly', 4)))))

Cheers - DV

Not applicable

Thanks a lot!

Not applicable

## Re: Sort values in a chart legend

But what if the legend doesn't represent each separate member in a dimension;

But a separate expression; i.e. sum of income, sum of bonus ;

What determines the order then?