Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
AtheerYahya
Contributor
Contributor

load latest 4 years

Hi,

I have 13 years in "Years" column but i need to load only the latest 4 years in load editor.

 Years column:

Years
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021

 

i need to load:

Years
2018
2019
2020
2021

 

if we are in 2022, the Years loaded should be:

Years
2019
2020
2021
2022

 

and so on. Thanks

Labels (1)
3 Replies
MayilVahanan
MVP
MVP

Hi

I hope always your data is upto Yesterday or Today. 

In that case, try like below

Load * from yoursourcedata where Year >= Year(Today()-1)-4;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
AtheerYahya
Contributor
Contributor
Author

Hello,

thanks for your reply!

when i loaded it, it did not display any records.

 

here is my code:-

[MoamalatComplianceDepartment]:
LOAD Subject,
TransactionId,
Years;


SQL SELECT Subject,
TransactionId,
Years,
FROM x;

Store [MoamalatComplianceDepartment] into [lib://Qvds (xxx)/xxx.qvd](qvd);

Drop Table [MoamalatComplianceDepartment];

[MoamalatComplianceDepartment]:
LOAD Subject,
TransactionId,
Years
FROM [lib://Qvds (xxx)/xxx.qvd](qvd) where Years >= Year(Today()-1)-4;

MayilVahanan
MVP
MVP

Hi

Its looks good. Please send the sample data or app?

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.