Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor

simple if statement

Hello,

I'm new to qlikview.

I'm trying to write a simple if statement as part of the expression in a straight table. Keep getting errors:

I have two dates, which i subtracted from each other and the results are all over the place. I'm using if statement to normalize the results, to get values of 0,30,60,90,90+

if((CONTROL_DATE - PAID_THRU_DATE)<0,0,

IF(CONTROL_DATE - PAID_THRU_DATE)>90,'90+',

(CONTROL_DATE - PAID_THRU_DATE))

Qlikview only likes this part " if((CONTROL_DATE - PAID_THRU_DATE)" everything else is underscored in red.

Ideally wanted to create this normalized field as part of LOAD script but kept getting an error that field is not found.

I created a CONTROL_DATE field in the LOAD script and than tried using it in the same script and was getting the error that CONTROL_DATE does not exist.

Please help.

Thank you

Labels (1)
2 Replies
Highlighted
Employee
Employee

Re: simple if statement

Missing some brackets ....
if((CONTROL_DATE - PAID_THRU_DATE)<0,0,
IF((CONTROL_DATE - PAID_THRU_DATE)>90,'90+',
(CONTROL_DATE - PAID_THRU_DATE)))
Highlighted
Creator II
Creator II

Re: simple if statement

Apart from missing brackets, need convert the output as text as well

if( (CONTROL_DATE - PAID_THRU_DATE)<0,'0',
IF( (CONTROL_DATE - PAID_THRU_DATE)>90,'90+',
Text(CONTROL_DATE - PAID_THRU_DATE)
)
)

Hope this helps
ZZ