Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Silambarasan1306
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
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
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 <','-')

phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

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

Silambarasan1306
Creator III
Creator III
Author

Thank you so much..

Silambarasan1306
Creator III
Creator III
Author

Thank you so much..

jonathandienst
Partner - Champion III
Partner - Champion III

Rather use the much simpler:

     Num(Class(GrossEarnings,10000))

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