Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
aatish12345
Creator
Creator

Date range for years

Hello Everyone,

I have a date field which consists of dates from 2020-01-01 to 2021-08-31

I want to create a new field which will show below values when used in filter

>2021-08-31

2021

2020

<2020-01-01

 

I tried it using if statement but not able to achieve the above expected results..

 

Any help would be really appreciated!

 

Aatish

3 Replies
Vegar
MVP
MVP

Try an IF statement like this

If(DateField>=makedate(2021,9),'>2021-08-31', If(Year(DateField)=2021,'2021', if(Year(DateField)=2020,'2020','<2020-01-01')))

aatish12345
Creator
Creator
Author

Hi Vegar,

Thanks for the reply!

Actually I want to make a code dynamic.

The solution you've provided includes hardcoding.

 

Aatish

Vegar
MVP
MVP

Then you would need to replace the har coded  parts with some kind of logic. 

Alternatively you could look into creating an interval table and then apply your groups using interval match