Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

ashissau
Contributor III

Comparing two month fields

Hi ,

I have mydate column which return date as 2019-07-08 (YYYY-MM-DD) format, e.g 8th of Jul 2019.

I am trying to compare this field with now () function in a text object. Here is the syntax.

=IF(DATE(TRIM(MAX(mydate )),'MMM')=date(TRIM(NOW()),'MMM'),1,0)

so it would compare Jul=Jul , if this is true then return 1 or 0.

The above syntax is returning 0, please advise how should i approach. 

1 Solution

Accepted Solutions
lblumenfeld
Contributor II

Re: Comparing two month fields

The issue is that Qlik isn't really representing the MMM format as expected when you do the comparison in the "if".

So, either

=IF(Text(DATE(TRIM(MAX(MyDate )),'MMM'))=Text(date(TRIM(NOW()),'MMM')),1,0)

or

IF(Month(MAX(MyDate ))=Month(NOW()),1,0)

will work.

The second statement is simpler.

Hope this helps.

View solution in original post

2 Replies
lblumenfeld
Contributor II

Re: Comparing two month fields

The issue is that Qlik isn't really representing the MMM format as expected when you do the comparison in the "if".

So, either

=IF(Text(DATE(TRIM(MAX(MyDate )),'MMM'))=Text(date(TRIM(NOW()),'MMM')),1,0)

or

IF(Month(MAX(MyDate ))=Month(NOW()),1,0)

will work.

The second statement is simpler.

Hope this helps.

View solution in original post

ashissau
Contributor III

Re: Comparing two month fields

Thank you for your reply. Yes you are right