Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Genrating dynamic date

Hi all,

I have to generate some dynamic values in a table. For the moment the code is like that.

CAL:
LOAD * INLINE [
lib_date, VALDate
ADH_M0, 01/12/2009
ADH_M1, 01/11/2009
ADH_M2, 01/10/2009
ADH_M3, 01/09/2009
ADH_M4, 01/08/2009
ADH_M5, 01/07/2009
ADH_M6, 01/06/2009
ADH_M7, 01/05/2009
ADH_M8, 01/04/2009
ADH_M9, 01/03/2009
ADH_M10, 01/02/2009
ADH_M11, 01/01/2009
ADH_M12, 01/12/2008
];



Best regards

Gilles

I want to generate some alternative code to obtain for each load (the application will be load every month) the last 13 months. Can you help me ?

6 Replies
justinasp
Creator
Creator

Hi, Remy,

try something like this

FOR i=0 TO 12
LOAD 'ADM_M'&$(i) as lib_date, ADDMONTHS(MONTHSTART(TODAY()),-$(i)) as VALDate INLINE
[
var1, var2
$(lib_date), $(VALDate)
];
NEXT


Cheers,

Justinas

Not applicable
Author

Hi Justinas,

I got this error message

Erreur de syntaxe, FROM manquant ou mal placé :
LOAD 'ADM_M'&0 as lib_date,
ADDMONTHS(MONTHSTART(TODAY()),-0) as VALDate
INLINE[var1, var2, ]
LOAD 'ADM_M'&0 as lib_date,
ADDMONTHS(MONTHSTART(TODAY()),-0) as VALDate
INLINE[var1, var2, ]

regards

Gilles

justinasp
Creator
Creator

The problem could be if you copied the script. Rewrite code as you see in my message. If you still have an error I'll attach a file.

Good luck

Not applicable
Author

hi Remy,

try this:

LOAD 'ADM_M'& (rowno()-1) as lib_date,

ADDMONTHS(MONTHSTART(TODAY()),(1-rowno())) as VALDate

autogenerate 13;

Alex

Not applicable
Author

Hi Justinas,

It works

Thanks a lot for your help

Regards

Gilles

Not applicable
Author

Hi Alex,

Thanks for your help. It works.

Best regards

Gilles