Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using Date in Script

Using tthis code, QVDATE = 2-28-2013.  Why does [As of Date] show as 5-31-1894?

Pol:
LOAD date(max([Month End Date]),'MM-DD-YYYY') as MonthEndDate1
FROM policy$(LoadYear).qvd (qvd);

LET QVDATE = peek('MonthEndDate1', 0, 'Pol');

Drop Table Pol;

MRSS:
LOAD *,
Date($(QVDATE),'MM/DD/YYYY') as [As of Date];

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try: Date#('$(QVDATE)','MM/DD/YYYY') as [As of Date];

$(QVDATE) will be evaluated as 2 - 28 - 2013 = -2039 if you use it in the date() function. Try it in a textbox to see what happens: =date(-2039)



talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

Try: Date#('$(QVDATE)','MM/DD/YYYY') as [As of Date];

$(QVDATE) will be evaluated as 2 - 28 - 2013 = -2039 if you use it in the date() function. Try it in a textbox to see what happens: =date(-2039)



talk is cheap, supply exceeds demand
CELAMBARASAN
Partner - Champion
Partner - Champion

MRSS:

LOAD *,

Date('$(QVDATE)','MM/DD/YYYY') as [As of Date];

Use enclose the variable expression in single quotes.