Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Master calender

Hi,how to create master calender please help me

Regards,

Nagendra

7 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Transaction:

Load

*

FROM Transaction;

CalendarMaster:

LOAD

    Date(InvoiceDate) AS InvoiceDate,

    Year(InvoiceDate) AS Year,

    'Q' & Ceil(Month(InvoiceDate) / 3) AS Quarter,   

    Month(InvoiceDate) As Month,

    Day(InvoiceDate) As Day,

    Week(InvoiceDate) As Week;

Load Date(MinDate + IterNo() -1 ) AS InvoiceDate While (MinDate + IterNo() - 1) <= Num(MaxDate);

Load

    Min(InvoiceDate) AS MinDate,

    Max(InvoiceDate) AS MaxDate

RESIDENT Transaction;

Regards,

Jagan.

Not applicable
Author

Hi Nagendar,

check this

Creating master calendar

Hope this helps.

Regards,

Barathiraja

Gysbert_Wassenaar

See this blog post: The Master Calendar and this document: The Fastest Dynamic Calendar Script (Ever)


talk is cheap, supply exceeds demand
alkesh_sharma
Creator III
Creator III

Easiest way of doing is to Take the resident of your transaction table and pull the date filed:

read more about creating a master calender on the below link:

Creating A Master Calendar

engishfaque
Specialist III
Specialist III

Dear Nagendar,


Here it is,


Day(DateFeild) AS CalendarDayOfMonth

WeekDay(DateFeild) AS CalendarDayName
Week(DateFeild) AS CalendarWeekOfYear
Month(DateFeild) AS CalendarMonthName
'Q' &
Ceil(Month(DateFeild)/3) AS CalendarQuarter
Year(DateFeild) AS CalendarYear,

WeekName(DateFeild) as CalendarWeekNumberAndYear
MonthName(DateFeild) as CalendarMonthAndYear
QuarterName(DateFeild) as CalendarQuarterMonthsAndYear

DayStart(DateFeild) as CalendarDayStart
WeekStart(DateFeild) as CalendarWeekStart
MonthStart(DateFeild) as CalendarMonthStart
QuarterStart(DateFeild) as CalendarQuarterStart
YearStart(DateFeild) as CalendarYearStart

DayEnd(DateFeild) as CalendarDayEnd
WeekEnd(DateFeild) as CalendarWeekEnd
MonthEnd(DateFeild) as CalendarMonthEnd
QuarterEnd(DateFeild) as CalendarQuarterEnd
YearEnd(DateFeild) as CalendarYearEnd;



Kind regards,

Ishfaque Ahmed

amit_saini
Master III
Master III

Hi,

Try this:

LET vMinDate = num(makedate(2014));

LET vMaxDate = num(today());

Datefield:

LOAD

    $(vMinDate) + IterNo() -1 as Datefield

AUTOGENERATE (1)

WHILE $(vMinDate) + IterNo() -1 <= $(vMaxDate);

Calendar:

LOAD

    Datefield as Date_Key%,

    date(Datefield) as Date,

    year(Datefield) as Year,

    month(Datefield) as Month,

    day(Datefield) as Day,

    week(Datefield) as Week,

    weekday(Datefield) as Weekday

RESIDENT Datefield;

drop table Datefield;

Thanks,

AS

its_anandrjs

Hi,

1. Questions is do you have single transactional date field in the table.

2. Master calendar based on single date field or it is multiple date.

For first you can try this 

MinMaxDate:
Load
Num(Min(TransacDate)) as MinTransacDate,
Num(Max(TransacDate)) as MaxTransacDate
Resident Sales;

Let vMinTransacDate = NUM(Peek('MinTransacDate',0,'MinMaxDate'));
Let vMaxTransacDate = NUM(Peek('MaxTransacDate',0,'MinMaxDate'));
LET vTransacToday    = NUM(Today());
Let vNoOfDays = vMaxTransacDate - vMinTransacDate + 1 ;

Drop Table MinMaxDate;

TransacDateField:
Load
Date($(vMinTransacDate) + RowNo() - 1)    as TempTransacDate
AutoGenerate $(vNoOfDays);

TransacDateMasterCalendar:
LOAD
TempTransacDate                              as TransacDate,
Day(TempTransacDate)            as TransacDay,
WeekDay(TempTransacDate)        as TransacWeekday,
NUM(WeekDay(TempTransacDate))   as TransacWeekDayNO,
Week(TempTransacDate)           as TransacWeek,
Month(TempTransacDate)          as TransacMonth,
Num(Month(TempTransacDate))     as TransacMonthNO,
'Q' &
ceil(month(TempTransacDate) / 3) as TransacQuarter,
Year(TempTransacDate)           as Year,
Date (MonthStart(TempTransacDate) , 'MMM YYYY') as TransacMonthYear

RESIDENT TransacDateField
ORDER BY TempTransacDate ASC;

DROP TABLE TransacDateField;


And for second read this posts

Canonical Date

http://community.qlik.com/message/541339#541339

Regards

Anand