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: 
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];

Labels (1)
1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

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
Partner - Champion III
Partner - Champion III

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.