Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sort on straight table using class function

Hi all,

Please see below. Actually I want to sort on First Column(Net Sales Bands).

I am using expression.

replace(replace(CLASS(Aggr(sum({<DECDDT1 = {">=$(vFromDate)<=$(vToDate)"}>}[Net Sales]),accpg_accno),1000,'-'),'<=',''),'<','')

its does not sort properly if I double click on column heading.  is there any way to sort as numbers.

Thanks

Class.PNG.png
Vinay

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

DUAL(replace(replace(CLASS(Aggr(sum({<DECDDT1 = {">=$(vFromDate)<=$(vToDate)"}>}[Net Sales]),accpg_accno),1000,'-'),'<=',''),'<',''), CLASS(Aggr(sum({<DECDDT1 = {">=$(vFromDate)<=$(vToDate)"}>}[Net Sales]),accpg_accno),1000,'-'))


Now go to sort tab...

Select Number Value by Asc or desc

View solution in original post

3 Replies
MK_QSL
MVP
MVP

DUAL(replace(replace(CLASS(Aggr(sum({<DECDDT1 = {">=$(vFromDate)<=$(vToDate)"}>}[Net Sales]),accpg_accno),1000,'-'),'<=',''),'<',''), CLASS(Aggr(sum({<DECDDT1 = {">=$(vFromDate)<=$(vToDate)"}>}[Net Sales]),accpg_accno),1000,'-'))


Now go to sort tab...

Select Number Value by Asc or desc

Nicole-Smith

By using the replaces, you're changing the result of the class, which should be a dual, to a text string.  Simply getting rid of the replaces should solve this problem and allow it to sort as a number (you can use this as a Sort by Expression on the Sort tab):

CLASS(Aggr(sum({<DECDDT1 = {">=$(vFromDate)<=$(vToDate)"}>}[Net Sales]),accpg_accno),1000,'-')

Not applicable
Author

Thanks Manish & Nicola,

Its working perfect.

Regards

Vinay