Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calander

Hello!

Can anyone send me the script of a basic calander?

Thanks!

Marco

11 Replies
Not applicable
Author

Hi,

this is the common example for master calender. and try it with more data instead of one month data. because u learned lot thing in that while using huge data's .

Date:
Load Date as Date,
if(Month(Date)<=3,Month(Date)+9,Month(Date)-3 ) as Month_Code,
year(Date) as Year,
month(Date) as Month,
week(weekname(Date,-13)) as Week,
day(Date) as Day
resident (Tabllename)
where year(Date) > 2007 and week(weekname(Date,-13)) < 53
;

Not applicable
Author

Hi,

Sorry, this is the basic script for calander .

Date:
Load Date as Date,
if(Month(Date)<=3,Month(Date)+9,Month(Date)-3 ) as Month_Code,
year(Date) as Year,
month(Date) as Month,
week(weekname(Date,-13)) as Week,
day(Date) as Day
resident (Tabllename)
where year(Date) > 2007 and week(weekname(Date,-13)) < 53
;

Miguel_Angel_Baeyens

Hello Marco,

There is a very good entry in the Wiki about this written by Michael Solomovich (credits to him).

Hope that helps.

brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi,

here is a Calender to integrate in your applications.

Not applicable
Author

First of all thanks for the quick reactions!

But I'm not there yet.

Can you tell me what is going wrong here?

LET Start = floor(YearStart(AddMonths(today(), -12*3)));
LET End = floor(YearEnd(AddMonths(today(), 12)));

LET NumOfDays = End - Start + 1;

Date_src:
LOAD
$(Start) + Rowno() -1 as DateId
AUTOGENERATE $(NumOfDays);

Calendar:
LOAD
DateId, // just in case
date(DateId) as Date, // it will be in format defined in your SET DateFormat=, or in your system format
day(DateID) as Day,
week(DateID) as Week,
month(DateID) as Month, // simple month name; it is dual - numeric and text
dual(month(DateID) & '-' & year(DateID),
year(DateID) & num(month(DateID), '00')) as MonthYear, // Month-Year format, dual
year(DateID) as Year,
weekday(DateID) as Weekday,
'Q' & ceil(month(DateID)/3) as Quarter, // in format Q1, Q2, Q3, Q4
dual('Q' & ceil(month(DateID)/3) & '-' & year(DateID),
year(DateID) & ceil(month(DateID)/3) as QtrYear // Qn-Year, dual
// and whatever else you may want here...

RESIDENT Date_src;
Drop Table Date_src;

LET Start = null();
LET End = null();
LET NumOfDays = null();









gandalfgray
Specialist II
Specialist II

Just two basic syntax errors, as far as i can see:

You need to add a ")" before "as QtrYear" (to end the dual-function)

You need to replace all "DateID" with "DateId" or vice versa

hth

Not applicable
Author

Thanks!

I think the script is oke right now.

The next error is DateId filed not found.

Where is this field suppose to be?

Not applicable
Author

Hi,

This DateID Field must be the field in your table which you want to connect to the calendar.

-Sravan

gandalfgray
Specialist II
Specialist II

Did you replace all DateId with DateID?

Remember that the field names are case sensitive.