Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
varunreddy
Creator III
Creator III

String to Date

Hi All,

I have date in 'MMM DD YYYY' format.

I am trying to get the data after 8/8/2015. So I am trying to convert the string into Date.

I am trying something like this:

=if(Date(Date#([As of Date],'MMM DD YYYY'),'MM/DD/YYYY')>='08/08/2015', 'Yes', 'No')

This is working only if, Month is greater than 'August'. If I select Jan 10 2016, it is dispalying the output as 'No'. I want to display it as 'Yes', as it is greater than 8/8/2015

Thanks in advance.

Best Regards,

Varun Reddy

11 Replies
sunny_talwar

I am not sure why '08/08/2015' worked for some dates and not for other dates, but the reason I find MakeDate to be more reliable then date within single quote is because of the following 2 reasons

1) QlikView won't interpret it as date for any number of reasons. One could be the date format supplied doesn't match your SET DateFormat at the beginning.

2) 08/08/2015 is easy to interpret as 8th August, but 08/07 can be Aug 7th or July 8th. Making the distinction can be difficult if you just have date. With MakeDate() function you are sure what is what. MakeDate take the following arguments -> MakeDate(Year, Month, Date). So you are 100% sure of your inputs.

HTH

Best,

Sunny

swuehl
MVP
MVP

Varun Reddy,

it's indeed kind of strange what you observed.


Are you sure you made selections in [As of Date] and not in another calendar field, so that [As of Date] might show multiple possible values for your specific selection (just asking because an as-of-table will usually have two fields with similar values)?


In this case,

=if(Date(Date#([As of Date],'MMM DD YYYY'),'MM/DD/YYYY')>='08/08/2015', 'Yes', 'No')


will return 'No', because the implicite Only( [As of Date] ) will return NULL, hence the comparison fails.