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: 
qlikviewwizard
Master II
Master II

What does this expression do?

Hi All,

What does this expression do? Thanks in advance.

replace(Class(Age,5), '<= x <','-') as GroupAge,

1 Solution

Accepted Solutions
maxgro
MVP
MVP

explain in yellow and bold in script

1.png

tmp:

load

  RowNo() as People,

  floor(rand()*100) as Age

AutoGenerate 100;

load

  *,

  replace(Class(Age,5), '<= x <','-') as GroupAge,

  Class(Age,5) as GroupAge2

Resident tmp;

DROP Table tmp;

View solution in original post

5 Replies
qlikviewwizard
Master II
Master II
Author

Please explain and give an example.

maxgro
MVP
MVP

explain in yellow and bold in script

1.png

tmp:

load

  RowNo() as People,

  floor(rand()*100) as Age

AutoGenerate 100;

load

  *,

  replace(Class(Age,5), '<= x <','-') as GroupAge,

  Class(Age,5) as GroupAge2

Resident tmp;

DROP Table tmp;

qlikviewwizard
Master II
Master II
Author

Hi maxgro

Thank you so much. I got it.

jagan
Partner - Champion III
Partner - Champion III

Hi,

Class() is used to group the values with the specified ranges or called it as Buckets. 

replace(Class(Age,5), '<= x <','-') as GroupAge

The above script creates the age group with the interval of 5, when you do this you will the format like

5 <= x < 10 to remove the symbols between the we use the Replace().

HOpe this helps you.

Regards,

Jagan.

qlikviewwizard
Master II
Master II
Author

Hi jagan

Thank you for detail explanation.