Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Master Calendar Date issue

Hi All,

  Find my application data Model. In that I need to use a master calendar date for all the charts. However I  am having Master calendar script readily I am not able to get the proper values.

Ex:

  If domain having date from Jan01,Jan 02...Jan30, when I am using master Calendar date I am getting some other date(Feb 14)

By seeing my data modle kinldy let me know how to solve this issue

16 Replies
Anonymous
Not applicable
Author

Hi,

Please can u copy & paste Master Calendar script here.

So will try to help.

Regards

Neetha

Anonymous
Not applicable
Author

Hi Neetha,

   My script will go like this

Link_Table:

Load SLD_KEY,

     SLD_DT As Create_Date

     Resident SLD;

cONCATENATE

Load Version_Key,

     Version_Date As Create_Date

     Resident Vesion;

Concatenate

Load SLA_KEY

     SLA_Date as Create_Date

      Resident SLA;

//*****Calendar*****////

Let V_mindate=Num(Date('05/01/2014'));

Let V_Maxdate=Num(Today());

Temp_Cal:

Load $(V_mindate)+ITERNO() As Num

Date($(V_mindate)+ITERNO()-1) As Temp_Date

Autogenerate (1) While

($(V_mindate)+ITERNO()-1 <= $(V_Maxdate);

Calendar:

Load Temp_Date As Create_Date

Resident Temp_Cal;

Drop Table Temp_Cal;

Anonymous
Not applicable
Author

Hi All,

Any idea/Suggestion on this?

-Jay

Anonymous
Not applicable
Author

Hi,

Please use the script below to create a master calendar.

// Please update your DATECOLUMN and Source table Name (SOURCETABLE)

QuartersMap: 

MAPPING LOAD 

rowno() as Month,

'Q' & Ceil (rowno()/3) as Quarter

AUTOGENERATE (12);

Temp:

Load

               min(DATECOLUMN) as minDate,

               max(DATECOLUMN) as maxDate

Resident SOURCETABLE

Let varMinDate = Num(Peek('minDate', 0, 'Temp'));

Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));

DROP Table Temp;

TempCalendar:

LOAD

               $(varMinDate) + Iterno()-1 As Num,

               Date($(varMinDate) + IterNo() - 1) as TempDate

               AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate);

MasterCalendar:

Load

               TempDate AS DATECOLUMN,

               week(TempDate) As Week,

               Year(TempDate) As Year,

               Month(TempDate) As Month,

               Day(TempDate) As Day,

               YeartoDate(TempDate)*-1 as CurYTDFlag,

               YeartoDate(TempDate,-1)*-1 as LastYTDFlag,

               inyear(TempDate, Monthstart($(varMaxDate)),-1) as RC12,

               date(monthstart(TempDate), 'MMM-YYYY') as MonthYear,

               ApplyMap('QuartersMap', month(TempDate), Null()) as Quarter,

               Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear,

               WeekDay(TempDate) as WeekDay

Resident TempCalendar

Order By TempDate ASC;

Drop Table TempCalendar;

Note:you can change according to your requirements.

Regards

Neetha

Anonymous
Not applicable
Author

Hi Neetha,

    Still I am having same issue.The master calendar date is not matched with source table dates. As I am using date as Dim I need to show this

-Jay

Anonymous
Not applicable
Author

Hi,

Please can you post your modified script.

Regards

Neetha

Anonymous
Not applicable
Author

Hi,

  Attached sample application which contains the original table structure.

Thanks,

Jay

ferha_jafri
Partner - Creator III
Partner - Creator III

Did you check the formats of Dates in which format do you have in the database and in qvw did you gave the format of Date which you want in the Date variable declared in the start , this issue usually happen when the Date formats did not match.

Anonymous
Not applicable
Author

Hi,

please copy& paste the code here.

So can help.

Regards

Neetha