Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Showing 0 Bars but maintaining order

Hi All,

I have a bar chart with 6 categories, e.g. Prohibited, Restricted, High, Very High, Moderate, Low. In my load script I created a order column for the sorting of the bars in the chart which goes something like:

if(COL = 'prohibited', 1,

if(COL = 'restricted', 2,

if(COL = 'very high', 3,

if(COL = 'high', 4,

if(COL = 'moderate', 5,

if(COL = 'low', 6, 2)))))) AS COL_SORT

I also have the "Show All Values Option" checked which shows the categories with 0 counts. What I find is that sorting only partially works in that if I have volume in each category the order works but if there are 0 bars there are no guarantees the sort works.

My question is: Is there a way to guarantee the order of the bars no matter whether is the bar count is 0 or more?

Kind Regards,

Lorcan

1 Solution

Accepted Solutions
sunny_talwar

How are you using COL_SORT? As in expression on the sort tab? Try to use this

Only({1} COL_SORT)

View solution in original post

4 Replies
vishsaggi
Champion III
Champion III

Can you share a sample to look into?

pradosh_thakur
Master II
Master II

don't suppress null or zero values. it should work

regards

Pradosh

Learning never stops.
sunny_talwar

How are you using COL_SORT? As in expression on the sort tab? Try to use this

Only({1} COL_SORT)

arjakumar
Contributor III
Contributor III

Hi Lorcan,

Could you please use load inline dual function for the custom sorting.

load dual(String,Numrep) as COL_SORT inline

[String, Numrep

prohibited, 1,

restricted, 2,

very high, 3,

high, 4,

moderate', 5,

low, 6];

In chart properties under sort tab please give numerical ascending.