Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

rammuthiah
Contributor II

Date Logic

I have a date format like

1. date(YYYY-MM-DD) and

2. date(YYYY-MM-'28') as Date

I have to compare 2 dates if 1>2,'Late','Not Late'.

When I tried it always showing as false condition

9 Replies
chinnuchinni
Contributor III

Re: Date Logic

you can try with this,

if(num(date(datefield1,'YYYY-MM-DD')) >num(date(datefield2,'YYYY-MM-DD')) ,'Late','Not Late')

chinnuchinni
Contributor III

Re: Date Logic

=if(num(date(MakeDate(2011,01,12),'DD-MMM-YYYY')) > num(date(MakeDate(2011,01,6),'DD-MMM-YYYY')),'Yes','No')

Re: Date Logic

You mean to say you want to compare all dates with 28th of the same month?

Please clarify so that we can help further.

rammuthiah
Contributor II

Re: Date Logic

Yes.

sasiparupudi1
Honored Contributor III

Re: Date Logic

=if(Num(date#('2018-01-29','YYYY-MM-DD')) >num(date#('2018-01-28','YYYY-MM-DD')) ,'Late','Not Late')

sasiparupudi1
Honored Contributor III

Re: Date Logic

if not working, pl provide some example dates

Gabriel
Valued Contributor II

Re: Date Logic

Hi,

Where is your data coming from, i.e. database?

In some instance it's best to FLOOR the date and format the output before you can compare the 2 fields.

Gabriel

dwforest
Valued Contributor

Re: Date Logic

if(datefield < monthstart(datefield) + 28,'Not late','late')

dwforest
Valued Contributor

Re: Date Logic

oops + 27