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

Stacked Bar Chart legend not sorting correctly

I'm using Qlik Sense Desktop February 2020 Patch 9, attached you can find the test app used with some data.

I'm having troubles sorting the legend of a stacked bar chart. The data is something like this

YearQuarterRisk_IDFunctional_AreaPriorityPriority_long_name
2019Q4RSK-023NBuona3 - Buona
2019Q4RSK-024NBuona3 - Buona
2019Q4RSK-030OLieve1 - Lieve
2019Q4RSK-030ODiscreta2 - Discreta
2019Q4RSK-030OOttima4 - Ottima
2019Q4RSK-020PLieve1 - Lieve
2019Q4RSK-002PDiscreta2 - Discreta

 

I want a stacked bar chart with Funcional_Area and Priority, with the value being Count(Risk_ID). I need the Priority values to be ordered according to the number in Priority_long_name (i.e. by left(Priority_long_name,1)) , this works great in a table but doesn't quite work for the legend of the stacked bar chart, see below

pic.png

As you can see above, even though the Priority values are correctly sorted for every record (I highlighted A which has all 4 values), the legend is not sorted correctly.

To me, this doesn't make sense and I don't know how to fix it. Making Priority dual doesn't seem to fix it. Is this a bug or am I missing something? Why does the legend in the Bar Chart works in such a weird (to me) manner?

Labels (3)
2 Replies
EmilyQiao
Contributor
Contributor

You can do some test to find out that sorting of legend is based on the sequence of the field that appears on the chart.

Ottima is always above Buona because there is no Buona in Function area "F".

I would suggest that you could use other extension such as "Bar & area chart" in Qlik Visualization bundle.

Or you could also change the data source to calculate RiskID number for all possible Function_Area and Priority. Then you will get all 4 Priorities for each Function_Area.

luigibrancati
Contributor II
Contributor II
Author

Thanks for your answer, but I thought that having all 4 Priority values on a  single Functional_Area would suffice. The Functional_Area value A has all 4 values, do I need to have all 4 of them for every Functional_Area value?