Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to create a list in the script which contains all the last 11 months, which will get updated dynamically
For example if i am running the app on 27th Sept 2017 , i should get the following list :
Oct 2016
Nov 2016
Dec 2016
Jan 2017
Feb 2017
Mar 2017
Apr 2017
May 2017
Jun 2017
Jul 2017
Aug 2017
Please help me on this.
Table:
load
Date(AddMonths(MonthStart(today()), -iterno()), 'MMM YY') as Date
AutoGenerate 1
While IterNo() <= 11;
Hi,
here is one of the methods to do it:
SET v_STARTDATE = '01/01/2016';
SET v_ENDDATE = '01/12/2017';
TMP_DATE:
LOAD date(date#('$(v_STARTDATE)','DD/MM/YYYY')-1 + recno() ,'DD/MM/YYYY') as Date
AUTOGENERATE (date#('$(v_ENDDATE)','DD/MM/YYYY') - date#('$(v_STARTDATE)','DD/MM/YYYY')) + 1 ;
DATE_TABLE:
LOAD
*,
Month(Date)&Year(Date) as Month_year
RESIDENT TMP_DATE
where Date < AddMonths(today(),-1) and Date > AddMonths(today(),-11);
DROP TABLE TMP_DATE;
Hope it helps
YB
Hi,
Thanks for the reply . But i dont want to hardcode the end date.can we make it as today()?
Table:
load
Date(AddMonths(MonthStart(today()), -iterno()), 'MMM YY') as Date
AutoGenerate 1
While IterNo() <= 11;
Yes for sure you can put whatever you want in the variables.
Tell me if you want an example
Thank you.This is exactly whai wanted
Thank you Youssef for ur support
you're welcome !