Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

arsenal83
Contributor

Month end between

Hi,

I have data with two date columns (DATE_A, DATE_B).

I need to flag records, which brakes a month (at least one month end between those two dates).

Any ideas?

Tags (1)
1 Solution

Accepted Solutions

Re: Month end between

Hi,

You can use this logic to flag them.

=if(Date2 >= MonthEnd(Date1),1,0)

Regards,

Kaushik Solanki

6 Replies

Re: Month end between

Could you please explain with more details what you need?

Thanks

senpradip007
Valued Contributor III

Re: Month end between

Try like:

if(DATE_A - DATE_B >=30, 1, 0) as Flag

From

<Data Source>;

Re: Month end between

Hi,

You can use this logic to flag them.

=if(Date2 >= MonthEnd(Date1),1,0)

Regards,

Kaushik Solanki

MVP
MVP

Re: Month end between

Hi,

Try like this

LOAD

*,

if(Fabs(DATE_A - DATE_B) >=30, 1, 0) as Flag

FROM DataSource;


OR


LOAD

*,

if(MonthName(DATE_A) <>  MonthName(DATE_B), 1, 0) as Flag

FROM DataSource;


Hope this helps you.


Regards,

Jagan.

vsudhakar
Contributor III

Re: Month end between

by using the set anlaysis it implemented

Re: Month end between

Another one could be:

Table:

LOAD *,

  If(Floor(MonthEnd(DATE_B)) > Floor(MonthEnd(DATE_A)), 1, 0) as Flag;

LOAD * Inline [

DATE_A, DATE_B

01/20/2016, 01/30/2016

02/12/2016, 03/03/2016

];


Capture.PNG

Community Browser