Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Highlighted
durgabhavani
Contributor

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


Tags (1)
1 Solution

Accepted Solutions

Re: Help me in sorting the order of legend?

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.

15 Replies

Re: Help me in sorting the order of legend?

Re: Help me in sorting the order of legend?

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))

joonasjaspi
New Contributor III

Re: Help me in sorting the order of legend?

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];

hrlinder
Honored Contributor

Re: Help me in sorting the order of legend?

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
Contributor

Re: Help me in sorting the order of legend?

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

Re: Help me in sorting the order of legend?

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

Re: Help me in sorting the order of legend?

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
Contributor

Re: Help me in sorting the order of legend?

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

hrlinder
Honored Contributor

Re: Help me in sorting the order of legend?

can you post example qvw?

Community Browser