Announcements
cancel
Showing results for
Did you mean:
Contributor

## Unable to create a new Calculated field.

In my dataset I have a "Age" field and I want o create a new calculated field based on the existing "Age" field named as "Age Category" in such a way that :

0 - 12 : Kid

13 - 17 : Teen

Above 65 : Senior

I have used the following expression to create the field but It is not working, It shows Incomplete visualization in the

preview section. How to resolve this?

If(Age >= 0 & Age < 13,'Kid',
IF(Age >= 13 & Age<18,'Teen',
if(Age >= 65,'Senior'))))

Labels (3)

• ### Visualization

1 Solution

Accepted Solutions
MVP

Are you using the Data Load Manager? It unfortunately does not allow the use of AND statements, so you'll have to just follow the nested if() statements. Which may actually be preferable in the first place since it's shorter (but somewhat harder for a human to read, I guess):

If(Age < 13, 'Kid',

if(Age < 18, 'Teen',

5 Replies
MVP

Use "and" rather than "&".

Contributor
Author

@Or wrote:

Use "and" rather than "&".

Even I tried with that, if I use "and" it will shows 'no preview enter valid expressions'.

Specialist II

Try this

If(Age >= 0 and Age < 13,'Kid',
IF(Age >= 13 and Age<18,'Teen',
if(Age >= 65,'Senior')))) as FieldName

if this is not working, please share the sample data.

MVP

Are you using the Data Load Manager? It unfortunately does not allow the use of AND statements, so you'll have to just follow the nested if() statements. Which may actually be preferable in the first place since it's shorter (but somewhat harder for a human to read, I guess):

If(Age < 13, 'Kid',

if(Age < 18, 'Teen',

Creator III

Result: