Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator III
Creator III

Explain how it’s works..

Could Anyone pls explain me below expression..

         Replace(Replace(Replace(Replace(Class(GrossEarnings,10000),'<=',''),'x',''),'<','-'),' ','')

1 Solution

Accepted Solutions
Highlighted
Not applicable

Class function will split [GrossEarnings] into buckets of 10,000 giving them names like 0 <= x < 10000

The Replaces changes this formatting to 0-10000 by replacing <= and x with nothing and < with -

You could also use: REPLACE(CLASS(GrossEarnings, 10000),'<= x <','-')

View solution in original post

5 Replies
Highlighted
Not applicable

Class function will split [GrossEarnings] into buckets of 10,000 giving them names like 0 <= x < 10000

The Replaces changes this formatting to 0-10000 by replacing <= and x with nothing and < with -

You could also use: REPLACE(CLASS(GrossEarnings, 10000),'<= x <','-')

View solution in original post

Highlighted
Partner
Partner

Class function will give result out put in this format 0 <= x < 10000

above expression is replacing all characters between 0 and 10000 with a dash "-"

you can use this to make it little easy

Replace(Class(GrossEarnings,10000),' <= x < ','-')

But still i htink you can improve more as above will give you output like below.

0-10000

10000-20000

20000-30000

....

....

If you see you dont know 10000 is included in first set or second set, so try using below

=subfield(Class(GrossEarnings,10000),' <= x < ',1)&'-'&subfield(Class(GrossEarnings,10000),' <= x < ',2)-1

this will give you output like this

0-9999

10000-19999

20000-29999

Highlighted
Creator III
Creator III

Thank you so much..

Highlighted
Creator III
Creator III

Thank you so much..

Highlighted

Rather use the much simpler:

     Num(Class(GrossEarnings,10000))

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein