Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Grouping ages into bands

New to Qlikview

So I have a huge set of data with information on different people. Ages range from 17 to 93. Is there a way I can simply group these ages into bands of 5. So instead of having age as 17,18,19...,93 it would be 17-21, 22-26,....

(A bit of context, I want to group these ages and work out the average Insurance premium charged in each age group. So instead of having an average for each age seperately it would have an average for each age group.)

Cheers

(Sorry if posted in wrong forum)

1 Solution

Accepted Solutions
marcus_malinow
Partner - Specialist III
Partner - Specialist III

Kristian,

a couple of ways to achieve this spring to mind.

Either, set up a table with the ranges and use an IntervalMatch in your load

Or if your groups are the same length (e.g. all are 5 years), you can use a Class in your charts.

Marcus

View solution in original post

12 Replies
marcus_malinow
Partner - Specialist III
Partner - Specialist III

Kristian,

a couple of ways to achieve this spring to mind.

Either, set up a table with the ranges and use an IntervalMatch in your load

Or if your groups are the same length (e.g. all are 5 years), you can use a Class in your charts.

Marcus

deepakqlikview_123
Specialist
Specialist

Hi,

You can use class function for this

Thanks

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI,

Have a look at the example posted on this post.

Class function | Qlik Community

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
yduval75
Partner - Creator III
Partner - Creator III

Not applicable
Author

Cheers for the help guys. Class worked just fine.

Much appreciated.

MarcoWedel

Custom Filter(unusual range)

Maybe also helpful if there would be unequal sized groups.

Regards

Marco

Not applicable
Author

Im now on something new and require grouping in different sizes. So now a list called 'Clicks' which is 0,1,2,3,4...15 I now need as 0,1,2,3-5,6-10,11+

I know you mentioned IntervalMatch but I literally have no idea how to use that.

Thanks again

marcus_malinow
Partner - Specialist III
Partner - Specialist III

Hi Kristian,

Marco's link above gives an example of IntervalMatch which may be useful.

Otherwise you could do something like this:

Data:

LOAD MatchedValue

etc, etc;

Intervals

LOAD * INLINE [

RangeName, RangeMin, RangeMax

0, 0, 0

1, 1, 1

2, 2, 2

3 - 5, 3, 5

etc, etc...

];

LEFT JOIN (Data)

IntervalMatch (MatchedValue)

LOAD RangeMin, RangeMax

RESIDENT Intervals;

LEFT JOIN (Data)

LOAD

RangeMin, RangeMax, RangeName

RESIDENT Intervals;

DROP TABLE Intervals;

Not applicable
Author

Sorry for this, like I said I'm completely new to qlikview, but what should I put in the first 'etc. etc.'?