# New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

## Age Range in a pie chart

Hello,

I have some customer and their ages and I try to show a pie chart which show how much customer have less than 25 years, between 26 and 50, between 51 and 60 and more than 61. I have this code but it said that the field Age is unknown.

BirthDate,

age(today(),BirthDate) as Age,

if(Age<=25,dual('<=25',25),

if(Age<=50,dual('26-50',50),

if(Age<=60,dual('51-60'),

dual('>=61',61)))) as [Age Range]

What can I do ?

Thank you for your future help =)

1 Solution

Accepted Solutions
Not applicable

## Re: Age Range in a pie chart

Try this:

*,

if(Age<=25,dual('<=25',25),

if(Age<=50,dual('26-50',50),

if(Age<=60,dual('51-60'),

dual('>=61',61)))) as [Age Range];

BirthDate,

age(today(),BirthDate) as Age

from abc.qvd;

or Try this:

BirthDate,

age(today(),BirthDate) as Age,

if(age(today(),BirthDate)<=25,dual('<=25',25),

if(age(today(),BirthDate)<=50,dual('26-50',50),

if(age(today(),BirthDate)<=60,dual('51-60'),

dual('>=61',61)))) as [Age Range]

3 Replies
Not applicable

## Re: Age Range in a pie chart

Try this:

*,

if(Age<=25,dual('<=25',25),

if(Age<=50,dual('26-50',50),

if(Age<=60,dual('51-60'),

dual('>=61',61)))) as [Age Range];

BirthDate,

age(today(),BirthDate) as Age

from abc.qvd;

or Try this:

BirthDate,

age(today(),BirthDate) as Age,

if(age(today(),BirthDate)<=25,dual('<=25',25),

if(age(today(),BirthDate)<=50,dual('26-50',50),

if(age(today(),BirthDate)<=60,dual('51-60'),

dual('>=61',61)))) as [Age Range]

Not applicable

Thank you ! =D

Not applicable

## Re: Age Range in a pie chart

Hello I have a similar problem. I have a BirthDate but not an age.. When I do the pie chart I set

=age(Today(),[BithDate])

as a calculated expression, but then the result is all of the ages of my customers. How can I get them represented as groups (20-30,30-40...)??