Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have products and start and end dates of their marketing campaigns. I am having trouble figuring out how to autogenerate month names that fall within each campaign's start and end date in the script.
Attached is the working file and the text object next to the table that shows desired result.
Thanks,
M
Try :
table:
LOAD * Inline [
Product, Campaign, StartDate, EndDate
A, 1, 1/1/2011, 3/1/2011
A, 2, 3/2/2011, 7/1/2011
A, 3, 7/2/2011, 12/1/2011
B, 1, 1/1/2012, 3/1/2012
B, 2, 3/2/2012, 7/1/2012
B, 3, 7/2/2012, 12/1/2012
];
T2:
load *, date(AddMonths(StartDate,IterNo()-1),'MMM-YY') as MonthName
Resident table While AddMonths(StartDate,IterNo()-1)<EndDate;
drop table table;
T3:
load Product,Campaign,StartDate,EndDate, Concat(MonthName,', ',num(MonthName) ) as Months
Resident T2 group by Product,Campaign,StartDate,EndDate;
drop table T2;
Try :
table:
LOAD * Inline [
Product, Campaign, StartDate, EndDate
A, 1, 1/1/2011, 3/1/2011
A, 2, 3/2/2011, 7/1/2011
A, 3, 7/2/2011, 12/1/2011
B, 1, 1/1/2012, 3/1/2012
B, 2, 3/2/2012, 7/1/2012
B, 3, 7/2/2012, 12/1/2012
];
T2:
load *, date(AddMonths(StartDate,IterNo()-1),'MMM-YY') as MonthName
Resident table While AddMonths(StartDate,IterNo()-1)<EndDate;
drop table table;
T3:
load Product,Campaign,StartDate,EndDate, Concat(MonthName,', ',num(MonthName) ) as Months
Resident T2 group by Product,Campaign,StartDate,EndDate;
drop table T2;
Thank you! That did it for me!