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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

Date Condition

Hi,

When I load data from my QVD file the condition highlighted in Red does not give the desired values. Pls advise me to rewrite the condition in a better and correct way

Load * from ................

(qvd)

WHERE MATCH (CLA_CODE,'MC','M4')

and Month(LOSS_DATE) &'-'& YEAR(LOSS_DATE)>='Oct-2012'

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

A date inequality using strings will not work - you will need to convert these to proper dates so that you have meaningful values to compare. But it looks like LOSS_DATE is already a date value:

     WHERE ... And LOSS_DATE >= '2012/10/01'

This will work if LOSS_DATE is a date value and the date in italics is the default date format for you system/model.

If you want to compare to a string, then:

     WHERE ... And LOSS_DATE >= Date#('Oct-2012', 'MMM-YYYY');

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

4 Replies
gautik92
Specialist III
Specialist III

Wat abt this?

Load * from ................

(qvd)

WHERE MATCH (CLA_CODE,'MC','M4')

and Month(LOSS_DATE)>='Oct' and Year(LOSS_DATE)>='2012'

MK_QSL
MVP
MVP

Load * from ................

(qvd)

WHERE MATCH (CLA_CODE,'MC','M4')

and LOSS_DATE>='01/10/2012'

jonathandienst
Partner - Champion III
Partner - Champion III

A date inequality using strings will not work - you will need to convert these to proper dates so that you have meaningful values to compare. But it looks like LOSS_DATE is already a date value:

     WHERE ... And LOSS_DATE >= '2012/10/01'

This will work if LOSS_DATE is a date value and the date in italics is the default date format for you system/model.

If you want to compare to a string, then:

     WHERE ... And LOSS_DATE >= Date#('Oct-2012', 'MMM-YYYY');

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
ashfaq_haseeb
Champion III
Champion III

Hi,

Try like Below

Load * from ................

(qvd)

WHERE MATCH (CLA_CODE,'MC','M4')

and where MonthName (LOSS_DATE)= 'Oct 2012';