Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rds694
Contributor
Contributor

Matching sort order of legend and graph - dual function not working

Hi, I'm having issues trying to get the sort order of the legend of my chart to match the sort order of the bars. As can be seen, it's currently not working.

rds694_0-1652878608406.png

 

I tried using a dual function with a response sorting key in order to solve the issue, but it's not working. I'm trying to use a dual function to combine the index into the field, but I'm having trouble getting it to work.

Here's a portion of my sorting key:

[SortingKey]:

Mapping Load Response, SortOrder
Inline
[
Response, SortOrder

'Strongly agree', 1
'Agree', 2
'Neither agree nor disagree', 3
'Disagree', 4
'Strongly disagree', 5

.....

'18-25', 1
'26-35', 2
'36-45', '3'
'46-55', 4
'56-65', 5
'65+', 6

.....

]

And then here's me trying to use the dual function, but as can be seen, it's not really working. For some values it seems like it's assigning random values from elsewhere in the table. And it sometimes behaves differently when using a number vs. a string as the alternative (for values not explicitly listed in my key.

[Group2Final]:
Load
Group2Response as Group2ResponseFinal
,ApplyMap('SortingKey', Group2Response, -99) as NumberSorting
,Dual(Group2Response, ApplyMap('SortingKey', Group2Response, -99)) as NumberCombined
,ApplyMap('SortingKey', Group2Response, 'abcde') as StringSorting
,Dual(Group2Response, ApplyMap('SortingKey', Group2Response, 'abcde')) as StringCombined
Resident Group2;

rds694_1-1652878608412.png

 

rds694_2-1652878608351.png

 

rds694_3-1652878608359.png

 

Any thoughts on why this could be? I can't figure out what I'm doing wrong with the dual function.

Labels (5)
0 Replies