Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Complicated date filters


Lease_IDSubspace_IDSubspace CommenceSubspace Expire
43650011/20/200612/31/2015
4366381/1/20165/31/2017
4366396/1/20165/31/2017
4366406/1/201612/31/2026

I have 2 dates Commence date and Expire date.

From Subspace Expire exclude everything which is already expired and include only Subspace Expire date which falls within the rolling next 12 months.

From Subspace Commence date include everything less than today also include Subspace Commence date which falls within the rolling next 12 months.

So here I should get 638,639,640 as Subspace Coomence date falls in between rolling 12 months eventhough Subspace Expire for 640 doesnt fall between rolling next 12 months.Is it doable ?

Thank you.

2 Replies
martinpohl
Partner - Master
Partner - Master

Hello,

so your where statement should be

where ([Subspace Expire] > today()                //only in future

and {Subspace Expire] <= date(addyears(today(),1))) and          //only until next 12 months

[Subspace Commence] <= date(addyears(today(),1))               //only dates less than next 12 months

addyears is by day, so from today (3/24/2016) addyears 1 gets 3/24/2017

so check if you need additionally monthstart or monthend

Regards

swuehl
MVP
MVP

Or maybe

WHERE

     NOT ( [Subspace Expire] < today() )           //Already expired excluded

     AND

     (

          ( [Subspace Expire] <= addyears(today(),1) )   //include

          OR

          (  [Subspace Commence] <= addyears(today(),1) )   // include     

     )

;