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

Dual function doesn't work as expected

I'm creating a HeatMap chart with two dimensions and one measure. I want to sort each dimension with a known condition sort_dim, so I'm trying to use Dual(dim1, sort_dimfunction to do it.

If I edit the dimension from dim1 to sort_dim&' | '&dim1 (just to see both the dimension and the sort condition in the chart) and I sort alphabetically, it works. I can see in the dimension the sort_dim to sort each dim1 and, as it is in the begining of the dimension, it sorts well. However, if I set the dimension as mentioned Dual(dim1, sort_dim), the HeatMap chart shows dim1 but not in the same order. How can it be possible? I thought the second part of Dual function was used to sort.

If it is not clear, an example of what is happening:

Dual('A',2)Dual('B',1)Dual('C',3) -->sorted alphabetically--> 'C', 'B', 'A' (e.g, unknown way of sorting)

2&' | '&'A', 1&' | '&'B', 3&' | '&'C' -->sorted alphabetically--> '1 | B', '2 | A', '3 | C'

Labels (1)
1 Reply
marcus_sommer

You couldn't use dual() within a sorting-expression because it returns the string-part of the value. You may apply num(dual()) to access the numeric part but it's superfluous because you could just set sort_dim for it.

- Marcus