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: 
awalhashim
Contributor II
Contributor II

Minus operation is not working

Hi i am working from backend to calculate the age of person.

so i get the Year of birth from their ID like this

if(LEFT(nric_number,2)>text(date(TODAY(),'YY')),'19'&LEFT(nric_number,2),'20'&LEFT(nric_number,2)) as YearID

Then i want to minus today date with year only like this.

text(date(TODAY(),'YYYY')) - if(LEFT(nric_number,2)>text(date(TODAY(),'YY')),'19'&LEFT(nric_number,2),'20'&LEFT(nric_number,2)) as Age

But is not working. Please help me.

Labels (1)
1 Solution

Accepted Solutions
santhiqlik
Creator
Creator

Can you try this.. converting both the expressions to numbers..

Num(date(TODAY(),'YYYY')) - Num(if(LEFT(nric_number,2)>text(date(TODAY(),'YY')),'19'&LEFT(nric_number,2),'20'&LEFT(nric_number,2))) as Age

View solution in original post

1 Reply
santhiqlik
Creator
Creator

Can you try this.. converting both the expressions to numbers..

Num(date(TODAY(),'YYYY')) - Num(if(LEFT(nric_number,2)>text(date(TODAY(),'YY')),'19'&LEFT(nric_number,2),'20'&LEFT(nric_number,2))) as Age