# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

New Contributor III

## IntervalMatch on Resident Table

Hello, I am trying to bucket uneven age groups on a resident table.  I'd like the buckets to be as follows.  I'd like the age group be appended to the resident table.  How would I accomplish that?

0 to 14

15-19

20-24

25-29

30-34

35-39

40-44

45-49

50-54

55+

Here's my resident table.

Quotes:
DRIVER_AGE,
POLICY_NUMBER
From C:\QlikView\Daily Quote\v14\CombinedQuotes.qvd (qvd);

Carl

Tags (2)
1 Solution

Accepted Solutions
Not applicable

## Re: IntervalMatch on Resident Table

Hello Carl,

Using interval match, example qvw attached.

EDIT: Age bucket table replaced with Age Group list box

Warm regards,

Nish

12 Replies
Contributor II

## Re: IntervalMatch on Resident Table

Try this:

DRIVER_AGE,
POLICY_NUMBER,

IF(DRIVER_AGE<15,'0 -14',

IF(DRIVER_AGE<20,'15 -19',

IF(DRIVER_AGE<25,'20 -24',

IF(DRIVER_AGE<30,'25 -29',

IF(DRIVER_AGE< 35,'30 -34',

IF(DRIVER_AGE< 40,'35 -39',

IF(DRIVER_AGE< 45,'40 -44',

IF(DRIVER_AGE< 50,'45 -49',

IF(DRIVER_AGE< 55,'50 -54','55+'))))))))) as [Age Group]

From C:\QlikView\Daily Quote\v14\CombinedQuotes.qvd (qvd);

Not applicable

## Re: IntervalMatch on Resident Table

Hello Carl,

Using interval match, example qvw attached.

EDIT: Age bucket table replaced with Age Group list box

Warm regards,

Nish

Contributor II

## Re: IntervalMatch on Resident Table

Did you look at the new field [Age Group]?

Not applicable

## Re: IntervalMatch on Resident Table

Hi Carl,

Have you had a chance to look at the replies from Caroline and myself yet?

New Contributor III

## Re: IntervalMatch on Resident Table

Hi Caroline, Thanks for replying.  I was hoping to avoid the nested if statements.  That is how I have it now.

Thanks again!

Carl

New Contributor III

## Re: IntervalMatch on Resident Table

Hi Nishant, Thank you for replying as well.  I was looking to add the field to the resident table not add a dimension table without using nested if statements.  Does that make sense?

Thanks,

Carl

New Contributor III

## Re: IntervalMatch on Resident Table

Also, is there any performance benefit to having the buckets as a dimension table instead of appending the field to your fact table?  If not then I will use your method.

Thanks,

Carl

New Contributor III

## Re: IntervalMatch on Resident Table

Sorry one more question...  I see you have start of 0 and end of 100 in your inline table.  How would you account for positive and negative infinity?

Not applicable

## Re: IntervalMatch on Resident Table

Hi Carl,

In QlikView a single table approach can be bad for RAM consumption and Script run time as far as I know, there are many pros for having the buckets as a dimension table instead. This approach offers flexibility too when dealing/administering future changes to the age group as you would just need to amend the inline load script below without touching your fact table. I hope this makes sense.

Warm regards,

Nish