Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
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

Please post an example document:


talk is cheap, supply exceeds demand