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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SQL 'Where' Condition

Hi,

I am currently creating a report that shows employees who applied leave late (at least 3 days before the actual leave day). I used a pivot table with expression of (LateLeaveApp < 3).

I would like to know how i can add sql condition statement under where clause to load only records that the difference between "Leave From Date" and "System Date" is less than 3.

Next, is it possible to hide my expression column under the pivot table?

[My Qlikview Report]

LOAD "Employee No_",
date("Leave From Date"),
date("Leave To Date"),
"Leave Type",
"Reason for Application",
Date("Leave From Date") - Date("System Date") as LateLeaveApp,
Year("System Date"),
"Entry Type",
date("System Date");
SQL SELECT "Employee No_",
"Leave From Date",
"Leave To Date",
"Leave Type",
"Entry Type",
"Reason for Application",
"System Date"
FROM ENSURE.dbo."Ensure Engineering (Live)$Leave Application"
where ("Employee No_" Between '2' and '5999') AND "Entry Type" = 0;

Thanks for your kind guidance.

1 Solution

Accepted Solutions
Not applicable
Author

Assuming you are using SQL Server it would be something like...

where DATEDIFF(dd, "Leave From Date", "System Date") < 3


Documentation on syntax of datediff can be found here... http://msdn.microsoft.com/en-us/library/aa258269(SQL.80).aspx

View solution in original post

1 Reply
Not applicable
Author

Assuming you are using SQL Server it would be something like...

where DATEDIFF(dd, "Leave From Date", "System Date") < 3


Documentation on syntax of datediff can be found here... http://msdn.microsoft.com/en-us/library/aa258269(SQL.80).aspx