Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
durgabhavani
Creator III
Creator III

Help me in sorting the order of legend?

Hi All,

I have one field dayscheck as below

dayscheck

0-10 Days

11-30 Days

31-50 Days

51-70 Days

70+ Days

I used the above dayscheck field in my caliculated dimension.

=if(wildmatch(Billing,'pending','approved','Dues','Verified','Closed'),dayscheck)

Now problem is with legend. It is diplaying the order in below way,

I am unable to sort the order  Can anyone please help me to sort the order in legend.

Thanks, Durgadays.PNG


1 Solution

Accepted Solutions
rubenmarin

Hi durga, I usually create the buckets using dual function, so the values are a number with a text representation, in script you can create dayscheck like this:

If....., Dual('0-10 Days', 1),

If(...., Dual('11-30 Days', 2)... and so on


This way the text is related to a number and they can be sorted easily, usually they are automatically sorted using the number.

View solution in original post

15 Replies
robert_mika
Master III
Master III

MK_QSL
MVP
MVP

Go to sort tab and under expression write below

=Only({1}Pick(Match(dayscheck,'0-10 Days','11-30 Days','31-50 Days','51-70 Days','70+ Days'),1,2,3,4,5))

Anonymous
Not applicable

You can also use Load Order sorting. Just put this this inline table at the begin of your script and drop it at the end.

SortingTable:

LOAD * INLINE [

dayscheck

0-10 Days

11-30 Days

31-50 Days

51-70 Days

70+ Days];

Anonymous
Not applicable

i have a shorter solution:

goto sort tab and define

=num(left(dayscheck,1)

and sort ascending

Expression will get 0,1,3,5, 7 and that should be all you need

durgabhavani
Creator III
Creator III
Author

Hi Robert,

Thanks for response!  I followed the same as in that link but it is not sorting the legend values. again it is showing the order as in screenshot.

Advice me!

Thanks,

durga

MK_QSL
MVP
MVP

=Only({1}Match(dayscheck,'0-10 Days','11-30 Days','31-50 Days','51-70 Days','70+ Days'))

rubenmarin

Hi durga, I usually create the buckets using dual function, so the values are a number with a text representation, in script you can create dayscheck like this:

If....., Dual('0-10 Days', 1),

If(...., Dual('11-30 Days', 2)... and so on


This way the text is related to a number and they can be sorted easily, usually they are automatically sorted using the number.

durgabhavani
Creator III
Creator III
Author

Hi Rudolf/Manish,

I have calicuated dimension in pie chart  as below:

=if(wildmatch(Billing,'pending','approved','Dues','Verified','Closed'),dayscheck)

Now my dimension label name is status, if i go to sort tab it is showing status dimension, i write condition as you said but it is not changing the dimension order.

@ Manish: how can i write set expression for dayscheck in calicualted dimension.

 

same clumsy order is displaying in legend as above screenshot.

Thanks,

Durga

Anonymous
Not applicable

can you post example qvw?