Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Abhi999
Contributor III
Contributor III

YEars FIlter in Script level

in Date filed i have years from 2010 to 2040 but i want only from year(today()) to next five years.

i have tried 
year( if("Date"<=AddYears(Today(),5),"Date")) as RequiredYear.

But this logic is giving years from 2010 to 2025.i am expecting 2020 to 2025.

4 Replies
Prashant_Naik
Partner - Creator II
Partner - Creator II

Hi,

You can write this script

If(Date<=Year(Addyears(today(),5)) and Date>=Year(Today()),Date) //write this expression in filter expression

Hope this will help.

Regards,

Prashant

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You could use a where clause on your load like this:

Where Year(Date)  >= Year(Today()) and Year(Date)  <= Year(Today()) + 5;

-Rob

 

Abhi999
Contributor III
Contributor III
Author

Thank you Prashant, it is working fine. but some issue with pie chart when i use calculation in Filter Expression pie chart is not working. i load logic in script and used in fort end.

Abhi999
Contributor III
Contributor III
Author

Thanks it is working.