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: 
userid128223
Creator
Creator

Date question

I have following 2 variable and i cannot seem to pass variable to weekstart function it gives incorrect results.

LET vToday = today();

Let WeekStart = date(WeekStart($(vToday),0,6));

Results:

vToday=1/12/2017

WeekStart=12/24/1899

Labels (1)
1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Try this ?

Let vWeekStart = date(WeekStart('$(vToday)',0,6));

View solution in original post

4 Replies
vishsaggi
Champion III
Champion III

Try this ?

Let vWeekStart = date(WeekStart('$(vToday)',0,6));

userid128223
Creator
Creator
Author

putting quotes around vToday varibale worked

'$(vToday)'

Can you please explain the logic why single quote is required.

vishsaggi
Champion III
Champion III

To my understanding the Datetime stores as a string value, so if we are using a variable value inside an expression or a function use I usually use single quotes. Thats the reason i believe we get some random dates. For eg: You can try below in a text object:

= Date('2015-10-12', 'YYYY-MM-DD')    -> With Quotes

= Date(2015-10-12, 'YYYY-MM-DD')     -> Without Quotes.

userid128223
Creator
Creator
Author

Thank You.