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: 
demarest
Contributor III
Contributor III

Bar Chart Sort Order - Histogram Buckets

Hi,

I am trying to use a bar chart to create a histogram.  I am struggling to get the buckets to order correctly.  In summary, here is what I have:

I have tried every alternative in the sort options and not of them do anything. I am retrieving my data from SQL Server OLE DB using a stored procedure and have tried sorting the data there, increasing and decreasing the number of buckets, converting the numbers into varchar, etc.  Here is my entire data set (the last two buckets are showing in between the 8th and 9th bucket in the wanna-be histogram):

   

fundNamebucketfrequency
FundA-1.391
FundA-1.280
FundA-1.170
FundA-1.060
FundA-0.950
FundA-0.8410
FundA-0.7313
FundA-0.6212
FundA-0.5117
FundA-0.4017
FundA-0.29212
FundA-0.18228
FundA-0.07246
FundA0.03853
FundA0.14828
FundA0.25722
FundA0.36711
FundA0.47711
FundA0.5872
FundA0.6972

Here is what I put into the Data Load Editor:

LIB CONNECT TO 'sql2012prod';

histo:
Load *;

SQL EXECUTE [Analytics_Staging].[dbo].[spcd_dailyreturnhistogram];

All I want is for the buckets to show in the chart in ascending order.  Any help would be appreciated.

 

1 Solution

Accepted Solutions
demarest
Contributor III
Contributor III
Author

Hi Ruben,

I figured out how to make it work, even if nothing is checked for sorting Frequency like this:

Qlik will not respect the sorting for Return Bucket.  But once I put Return Bucket ahead of Frequency then it works.  This now works:

View solution in original post

4 Replies
rubenmarin

Hi Charles, in the right panel there is a 'Sort' section, expand the bucket dimension and try setting to sort numerically->ascending.

demarest
Contributor III
Contributor III
Author

Thanks for the reply.  The reason for this post is that I tried all of (1) Sort by Expression (2) Sort Numerically (3) Sort Alphabetically (after changing the SQL to return varchar) for "bucket".  None of these have any impact on the chart, even if I switch from Ascending to Descending or do not select anything.  (you can see this in the first image if you scroll right).  Note however, if I sort by Frequency then the chart sorts, ie:

which is not what I want, I want the Horizontal Axis , "Return Bucket (%)"  to be in ascending order.  Any other ideas?

demarest
Contributor III
Contributor III
Author

Hi Ruben,

I figured out how to make it work, even if nothing is checked for sorting Frequency like this:

Qlik will not respect the sorting for Return Bucket.  But once I put Return Bucket ahead of Frequency then it works.  This now works:

rubenmarin

Hi Charles, as you did, Return Bucket should be the first, double-check if you have to sort numerically instead of alphabetically.