Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Age bands

Hi all,

Age in group on x axis?

I could manage to calculate age and represent in chart.

X axis - age in 10, 11, 12... 25... etc.

Y axis - total coubt of patients.

Created a  variable

vAgeCal = date (interval(patient arrival date - date of birth), 'YY')

I would like the x axis to be

10-15      16-20    20-25 instead of 10, 11,12..., 25

I am pretty new to qv. It would be great if anyone can help.

Thanks.

K.v

1 Solution

Accepted Solutions
Not applicable
Author

Resolved it by using an if condition in the load script.

View solution in original post

4 Replies
Or
MVP
MVP

You'll be wanting to use the Class() function.

Class(Age,5,'x',10) should be what you're looking for in this specific case, I think.

Not applicable
Author

Doesnt work. Might be I am writing the expression wrong.

Class(vAgeCal, 10, '10-20, 20) is what gave as an expression.

Is it correct? It does reload though.

Or
MVP
MVP

That does not look correct. The expression as I wrote it is what you should be using (replacing your age column with "Age"). I prefer to use it directly in a calculated dimension, rather than in the script (I think it works either way, though). If you want to understand exactly how Class() works, just look it up in the help file.

Not applicable
Author

Resolved it by using an if condition in the load script.