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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variables as part of an IF expression

Hi everyone,

I have the following IF statement that I would like to use. I have a table with an expression =$(vPatientAge)  which works fine. From this I wanted to set up some age groups, so I wrote this:

IF

(AGE(IncDate,$(vPatientAge))<0, 'INVALID',
IF(AGE(IncDate,$(vPatientAge))<18, '0-17',
IF(AGE(IncDate,$(vPatientAge))<65, '18-64',
IF(AGE(IncDate,$(vPatientAge))<100, '65-99', 
IF(AGE(IncDate,$(vPatientAge))<120, '100-120', 'OVER 120')))))   

   

The IF statement only returns a value of 'OVER 120' what ever the value returned by the variable. Am I doing something wrong in the expression that anyone can see?

Many thanks 

    

Phil

1 Reply
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Please post an example document:


talk is cheap, supply exceeds demand