Below script helps in generating the Master calendar. In this script I am getting the Minimum and Maximum dates in my Invoice table and generating the entries for each date in CalendarMaster table between minimum and maximum invoice date.
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);
Min(InvoiceDate) AS MinDate,
Max(InvoiceDate) AS MaxDate
Hope this helps others in generating the Master Calendar.