# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Contributor

## Create age from Year of Birth in Qliksense

1. In my table, I have only year of Birth. I need to calculate the age. Can some one help me.

2. Also, I need to group the age like 0>35, 35-45, 50-60 in a bar chart.

Help me out.

Tags (1)
1 Solution

Accepted Solutions
MVP

## Re: Create age from Year of Birth in Qliksense

Clever Anjos suggested a LOAD script solution, which is recommended.

If you want to use the expressions in a chart, remove the 'as Age'

=Age(Today(), MakeDate(BirthYear))

(and use this as calculated dimension?)

What is the measure of your chart?

8 Replies
Employee

## Re: Create age from Year of Birth in Qliksense

Create these fields into your script

1  - Age(Today(), MakeDate(youryearbirth)) as Age

2 - Using this field

If( Age < =35, '0>35',

If(Age <= 45,'35-45', '50-60')) as AgeBin

Valued Contributor II

## Re: Create age from Year of Birth in Qliksense

Try use Interval()

1 - Interval( Today()-BirthAge, 'D' ) /365 AS Age

2-

If( Age < =35, '0>35',

If(Age <= 45,'35-45', '50-60')) as Range

Contributor

## Re: Create age from Year of Birth in Qliksense

Its not working. My field name is BirthYear. So I tried it. It says error in expression.

Age(Today(), MakeDate(BirthYear)) as Age

Even I tried,

Age(Today(), MakeDate[BirthYear]) as Age

Contributor

## Re: Create age from Year of Birth in Qliksense

Hi,

Sry its not working. This is the script I tried out

Interval( Today()-BirthYear, 'D' ) /365 AS Age

Esteemed Contributor III

## Re: Create age from Year of Birth in Qliksense

This expression is certainly correct and must work

Age(Today(), MakeDate(BirthYear)) as Age

Something you're are not telling...  What are the values of the BirthYear field?

MVP

## Re: Create age from Year of Birth in Qliksense

Clever Anjos suggested a LOAD script solution, which is recommended.

If you want to use the expressions in a chart, remove the 'as Age'

=Age(Today(), MakeDate(BirthYear))

(and use this as calculated dimension?)

What is the measure of your chart?

Contributor

## Re: Create age from Year of Birth in Qliksense

Thanks Stefan, its working. Am using Emp ID as measure, so that I can find the age of a particular employee in my table. Is it fine.

I need help in grouping the ages. Help me out.

MVP

## Re: Create age from Year of Birth in Qliksense

Are you really using Emp ID as measure? That's kind of unusual, I would have used Emp ID as dimension and the age as measure, if you want to show the age per emp.

If you want to group by the age and show for example how many emps are in this age range, use something like

= If( Age < =35, '0>35',

If(Age <= 45,'35-45', '50-60'))

as calculated dimension and

=Count(DISTINCT [Emp ID])

as measure.

Buckets