Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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

Tags (1)
4 Replies
Not applicable

Re: loading data from last year until the current date

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

Re: loading data from last year until the current date

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

Employee
Employee

Re: loading data from last year until the current date

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"

Employee
Employee

Re: loading data from last year until the current date

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

LOAD 1,

     *

RESIDENT job

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

Community Browser