Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

If Statement Indicator

Please see attached for example.

I have two tables

FirstDate & EndDate. I would like to join the two table, then create an indicator based of StartDate and EndDate differences. See attached.  What I have is not working. Can someone help?

StartDate:
LOAD ID,
StartDate
FROM
ExampleData.xlsx
(
ooxml, embedded labels, table is StartDateData);


EndDate:
LOAD ID,
EndDATE
FROM
ExampleData.xlsx
(
ooxml, embedded labels, table is EndDateData);

JOIN (EndDate)
LOAD *
Resident StartDate ;
DROP TABLE StartDate;

Indicator:
LOAD
IF(StartDate - EndDATE <= 15, 'Y', 'N') AS Gap_Indicator,
//IF(EndDATE - StartDate >= 15, 'N', 'Y') AS Gap_Indicator2,
//IF(StartDate - EndDATE >= 5, 'N', 'Y') AS Gap_Indicator3,
//IF(StartDate - EndDATE <= 5, 'N', 'Y') AS Gap_Indicator4,
IDStartDate, EndDATE
RESIDENT EndDate;
DROP TABLE EndDate

1 Solution

Accepted Solutions
sunny_talwar

You might want to do EndDate - StartDate instead of the other way around

IF(EndDATE - StartDate <= 15, 'Y', 'N') AS Gap_Indicator,

View solution in original post

2 Replies
sunny_talwar

You might want to do EndDate - StartDate instead of the other way around

IF(EndDATE - StartDate <= 15, 'Y', 'N') AS Gap_Indicator,

sinanozdemir
Specialist III
Specialist III

Hi,

What's not working, the gap indicator? If so, try

IF(EndDATE - StartDate <= 15, 'Y', 'N') As Gap_Indicator

Hope this helps.