Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Editing script to add age group

I am trying to create a new age group from my excel spreadsheet that just contains the date of birth. I was able to successfully create an Age field (see below) but I don't know how to create the group. I think I'm missing the FROM text but I don't know what to type for the FROM for the age group since I'm making it up vs. pulling it from somewhere. Any ideas? Thanks!

LOAD MRN,

     [Patient Name],

     DOB,

     Age(Today(),DOB) as Age,

     Diagnosis,

     [Sum of Charges]

         

FROM

(ooxml, embedded labels, table is Sheet1);

LOAD 

if(Age > 10, 'Over 10',

if(Age <= 10 and age >= 6, '6 - 10',

if(Age <= 5 and age >= 4, '4 - 5',

if(Age <= 3 and age >= 1, '1 - 3',

if(Age < 1, 'Under 1'))))) as Age_Group;

1 Reply
swuehl
MVP
MVP

Try a preceding load:

LOAD *,

if(Age > 10, 'Over 10',

if(Age <= 10 and age >= 6, '6 - 10',

if(Age <= 5 and age >= 4, '4 - 5',

if(Age <= 3 and age >= 1, '1 - 3',

if(Age < 1, 'Under 1'))))) as Age_Group;

LOAD MRN,

     [Patient Name],

     DOB,

     Age(Today(),DOB) as Age,

     Diagnosis,

     [Sum of Charges]

FROM

(ooxml, embedded labels, table is Sheet1);

edit: and for better performing options, check this thread:

http://community.qlik.com/message/240288#240288