One 'tricky' thing in QlikView is the fact that a date field is dual (its a numerics formatted acoording to a format), but a variable is not dual.
So, when you do
vTwoWeeksAgo is a string, correct?
So it when you use that string you have to take care of this issue.
When I do comparisons I always format to a 'string-like comparision' 'YYYYMMDD'
I would rewrite your code to:
- LET vTwoWeeksAgo=Date(Today()-14,'YYYYMMDD');
- LOAD *
- RESIDENT TABLE_A
- WHERE date(DATECREATED,'YYYYMMDD') > '$(vTwoWeeksAgo)';
Thank you both for your help. I have tried your suggestions but unfortunately still cannot get the comparison to work. At present, this is what I have:
DATE#(PDDCR,'YYYYMMDD') AS DATECREATED
WHERE DATECREATED > $(vTwoWeeksAgo);