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: 
QlikBeginner1
Creator
Creator

comparison of dates

Hi,

I essentially have 4 date fields, 

datestart1

dateend1

datestart2

dateend2

I am trying to create a flag which essentially sets the flag as '1' where datestart1 and dateend1 is within datestart2 and dateend2.

e.g.

datestart1: 01/04/2019 

dateend1: 01/04/2020

datestart2: 01/03/2019

dateend2: 01/03/2021

This would occur as a Flag of '1' as datestart1 and dateend1 is within datestart2 and dateend2. However,

datestart1: 01/04/2019 

dateend1: 01/04/2020

datestart2: 01/03/2019

dateend2: 01/03/2020

This would occur as a Flag of '0', as the datestart1 and dateend1 is not within datestart2 and dateend2. 

Is there a function within Qlik that allows me to do this? or what would be the best way to do this?

thanks

 

Labels (2)
1 Reply
pradosh_thakur
Master II
Master II

You can use a simple if claue to do this. 

iF(datestart1>= datestart2 and datestart1<= dateend2 and dateend1>= datestart2 and dateend1<= dateend2 ,1,0) as Flag

Learning never stops.