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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

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
MVP
MVP

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.