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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
BoXiangWang
Contributor III
Contributor III

Sort the Legend in specific order

Hi experts,

I have a bar chart and I want to sort the legend by specific order. 

BoXiangWang_0-1729140939787.png

 

I need the specific color so I use the master item to set up the color palettes.

I found that I can use the following expression in the master item and it will show the order ascendingly.

Pick(Match(YOS_group, '<1 yr', '1-5 yrs', '6-10 yrs', '11-20 yrs', '21-30 yrs', '>30 yrs', 'NA'),
1,2,3,4,5,6,7)

However, the legend labels become the sequence.

BoXiangWang_1-1729141038269.png

 

I tried to use the reverse way to match the sequence and back to my original labels but failed.

Could you tell me how can I solve this problem? Thanks.

 

Labels (1)
5 Replies
VBD
Partner - Creator II
Partner - Creator II

Hello, If you try to write your fomula just in the sort expression  ?

Exemple below :

VBD_0-1729150905755.png

 

VBD_1-1729150937279.png

 

Regards,

 

Valentin Billaud
Next Decision
ChannaK
Creator
Creator

try dual function

BoXiangWang
Contributor III
Contributor III
Author

Thanks, I did that but still not successful.

=
Pick(Match(YOS_group,'<1 yr', '1-5 yrs', '6-10 yrs', '11-20 yrs', '21-30 yrs', '>30 yrs', 'NA'),
1,2,3,4,5,6,7)

BoXiangWang
Contributor III
Contributor III
Author

Yes, I did check that but don't know how to manage it.

anat
Master
Master

Use Dual function or create inline load like YOS_Group, YOS_Group_Sort then use YOS_Group_Sort field for order