Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Script distinct date + append 12 coming month

Hello,

I want to retrieve all distinct dates (all in format MMM YYYY, using MonthName function) from my fact table and then append them by the next coming 12 months, here is my script but it is not working. Any suggestion

tmp:
Load Distinct OpenMonth as newDate
Resident Fact;
CONCATENATE (tmp)
LOAD
MonthName(Max(OpenMonth),IterNo()) as newDate
RESIDENT Fact
while MonthName(Max(OpenMonth),IterNo()) <= MonthName(Today(),12)
;

2 Replies
Not applicable
Author

hi n.allano ,

Update your While Condicion as like below..

while num(Max(OpenMonth)) <= num(addmonths(date(Today()),12));

i think it will work....

Regards

A'run'

Not applicable
Author

Yes, you are right. I understood that when I use < > to compare dates, I need to take their numeric values. However, the solution is still not working