Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a loop to generate a table but the WHERE clause involves dates. They come out of the database as DD/MM/YYYY 00:00:00 (Qlik is set to date format of DD/MM/YYYY) The loop is working but if I put the where clause in I get no matches (If I take it out it brings back everything which I do not want). I have used Date(Floor) to try and remove the timestamp but it still remains if I do a straight table of EmployeLoad
[EmployeLoad]:
noconcatenate Load
"EMPLOY_REF",
SURNAME,
FORENAME,
MGR_REF,
fullname,
date(floor(STARTDATE)) as STARTDATE,
date(floor("LAST_WORKING_DAY")) as "LAST_WORKING_DAY"
For i = Weekend(today()-365) To Weekend(today()) step 7
Let iDate=Date(i);
TimeSheetsRequired:
LOAD Date($(iDate)) As TimeSheetWeekDate,
"EMPLOY_REF" as EmployeeRef
Resident EmployeLoad
Where STARTDATE <= Date($(iDate))
And ("LAST_WORKING_DAY" >= Date($(iDate)) OR isnull("LAST_WORKING_DAY"));
next
It could be your variable iDate that is causing you trouble.
Try using dollar expansion of the i.
Let iDate=Date('$(i)');