7 Replies Latest reply: Dec 15, 2016 8:19 PM by Silambarasan P

age groups

hi guys, i have a age dimension and i need to use it as age groups ex:(0-5,6-12,13-19,20-40,41-above), any idea what to do?

• Re: age groups

Hi,

If your age group is at constant intervals (5 to 10, 10 to 15, 15 to 20) the we can use class() function.

If it is of different intervals we can use if condition (if (Age>0 and Age <=5,'0-5').. etc. in scripting.

Thanks

• Re: age groups

thank you, the class worked for me but i couldn't change the x in the expression in the title of the graph, any idea how to work on that?

• Re: age groups

Hi Mena,

I am not sure on your query.

Could you please explain in detail.

If your requirement is to have a dynamic chart title, what exactly is your requirement.

Thanks.

• Re: age groups

Hi Meena,

I did the sample example using the if function,

Emp, Age

abc, 12

xyz, 5

pqr, 3

aaa, 8

bbb, 15

ccc, 17

yyy, 22

zzz, 35

ttt, 41

ooo, 55

rrr, 60

qqq, 1

www, 2

ddd, 9

kkk, 99

];

Write Expression in List box:

=if(Age>0 and Age <=5,'0-5',

if(Age>5 and Age <=12,'6-12',

if(Age>12 and Age <=19,'13-19',

if(Age>20 and Age <=40,'20-40',

if(Age>40 and Age >=41,'41-Above',Age)))))

Thank You,

-YJ

• Re: age groups

I won't realize this in a listbox, that's not good for performance.

Create a new field in your datas (e.g. age_class)

if(Age <=5,'0-5',

if(Age <=12,'6-12',

if(Age <=19,'13-19',

if(Age <=40,'20-40',

,'41-Above')))) as age_class,

Regards

• Re: age groups

Hi Martin,

I did the demo example as just to understand easily.

otherwise u\you can used in backed i.e in the script.

Also I like to ask how the performance is not good while writing the example in expression in the listbox

Thanks,

-YJ

• Re: age groups

Hi Meena,

You can try Interval Match.

Example:

Age_Groups:
[
low,high
0,10
11,20
21,50
51,above

]
;

Sample2:
[
name,CityId,age
Ana,1,5
Ara,1,9
brinda,1,20
cinda,1,22
ash,2,30
]
;

IntervalMatch(age)
load low as min_age,high as max_age
resident  Age_Group;

Renaming helps to remove synthetic keys.

Now in the chart you can use min_age &'-'&max_age. under dimension.

Hope this helps

Thanks,

Prajna