Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

CLASS function output adjust

Hello,

The output of the Class function on my dashboard is like:

   

0 <= dias < 3
3 <= dias < 6
6 <= dias < 9
9 <= dias < 12
12 <= dias < 15
15 <= dias < 18

But i want the result like '0 ~ 3 dias'. I´ve tried to use the replace function, but the expression lost the sort order, anyone have any idea how could i replace this without loose the sort order?

Thanks!

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

Here are two ways:

1. Keep dimension the same, and use expression in sorting:

=only(CLASS(dias_aberto0, $(vStep)))

2. Use the dimension:

=dual(REPLACE(CLASS(dias_aberto0, $(vStep)), '<= x <','~') & ' dias', CLASS(dias_aberto0, $(vStep)))

and use sorting numeric - ascending

Please find attached.

Hope this helps!

View solution in original post

9 Replies
alexandros17
Partner - Champion III
Partner - Champion III

I've not understood, please provide your example

marcus_sommer

Change the sorting on expression with these class-function without replace().

- Marcus

Not applicable
Author

An example was attached! Use the slider to view the sort order in the legend ! Alessandro Saccone

Not applicable
Author

I've not understood!

jerem1234
Specialist II
Specialist II

Here are two ways:

1. Keep dimension the same, and use expression in sorting:

=only(CLASS(dias_aberto0, $(vStep)))

2. Use the dimension:

=dual(REPLACE(CLASS(dias_aberto0, $(vStep)), '<= x <','~') & ' dias', CLASS(dias_aberto0, $(vStep)))

and use sorting numeric - ascending

Please find attached.

Hope this helps!

Anonymous
Not applicable
Author

Attached is the correct solution.

=DUAL(REPLACE(CLASS(dias_aberto0, $(vStep)), '<= x <','~')& ' dias',CLASS(dias_aberto0, $(vStep)))

sort by number then ascending

MK_QSL
MVP
MVP

Try like below...

=DUAL(REPLACE(CLASS(dias_aberto0, $(vStep)), '<= x <','~') & ' dias',CLASS(dias_aberto0, $(vStep)))

Once you use Replace function, the output of Class function convert from Number Format to Text Format.

Not applicable
Author

Thank you so much!

Not applicable
Author

Thanks, i'll remember that!