Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
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
sridhar240784
Creator III
Creator III

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

View solution in original post

4 Replies
sridhar240784
Creator III
Creator III

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

IAMDV
Master II
Master II

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
Author

Thanks a lot!

Not applicable
Author

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?