Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello All,
I have a requirement where I need to create a 12 month flag in my master calendar that would include the current month. I currently have a flag for the previous 12 months, ,InMonths(12, D, Today(), -1, num(month(Today()))) as Previous12Months, however I can't figure out the logic to generate the 12 month flag that includes the current month. This means that I would want to capture the current month with the previous 11.The intent is to use this flag as a filter in on an nPrinting report to automate some biweekly reports. Can anyone lend a hand? Any help would be much appreciated.
- Emmanuel
Hi Emmanuel,
On the calendar generation, try this:
let varMinDate = 40000;
let varMaxDate = Num(Today());
Calendar:
Load
*,
if(Num>=Num(MonthStart(AddMonths(Today(),-11))),1,0) as [Flag 12 Months];
LOAD
$(varMinDate) + Iterno()-1 As Num,
Date($(varMinDate) + IterNo() - 1) as TempDate
AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate);
That will set every date on your calendar based on the current month date.
Thing is you'll have to reprocess the calendar every month, as to include more dates.
In this way, only dates that are on the past 12 months will be flaged.
Felipe.