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

loading data from last year until the current date

Hi experts

I would like to load data, but only data from last year until the current date. This is my expression:

resident job where Jahr = 2013 group by prodnr;

How would I habe to script this?

Thank you very much for your help!

Jan

4 Replies
Not applicable
Author

LOAD 1,

     *

RESIDENT job

WHERE Jahr>=ADDMONTHS(YEARSTART(Now()),-12) ;

Should work it would be better to base it on a date field rather than year.

Not applicable
Author

hm, somehow this expression did not work for me...

JonnyPoole
Employee
Employee

If it has to be the beginning of last year (jan 1st) until today , you can't use a YEAR field in the filter, you have to use a Date field from your source . Assuming your date field is called 'Date' it will be something like this:

WHERE Date >=   YearStart( AddYears( Today(), -1 ))  and Date <= Today()

This will make sure your date is between "the first date of the year for today's date in the previous year" and "today's date"

JonnyPoole
Employee
Employee

Or if you don't have any dates > today in your data

LOAD 1,

     *

RESIDENT job

WHERE Jahr>= Year(  AddYears(Today(),-1) ) ;