Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
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
simenkg
Specialist
Specialist

You have an extra parenthesis at the start of your while statement.

Anonymous
Not applicable
Author

Hi Ferha,

    In my DB tables the date field is in YYY-MM-DD format, but I am changing the format into MM/DD/YYYY in my qvw. So date format looks fine

Anonymous
Not applicable
Author

Hi Simen,

   I am not able to identify. Can you enlighten on this?

simenkg
Specialist
Specialist

Autogenerate (1) While

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

Autogenerate (1) While

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

Not applicable
Author

Instead of using a WHILE i use variable called  vRange, which subtracts from your end date to your start date.

Please see example below.

LET vStart = Peek('StartDate',0,'DateRange')-1;

LET vEnd = Peek('EndDate',0,'DateRange')-0 ;

LET vRange = $(vEnd) - $(vStart);

TempDate:

LOAD

  $(vStart) + RecNo() AS DateNum

  AUTOGENERATE $(vRange);

//

CALENDAR:

LOAD

*,

AutoNumber(Period, 'PeriodID') AS [PeriodID],

AutoNumber(Year & Quarter, 'QuarterID') AS [QuarterID]

;

LOAD Distinct

Date(DateNum) AS Date,

Year(DateNum) AS Year,

Month(DateNum) AS Month,

Year(DateNum) * 100 + Month(DateNum) AS [Period],

'Q'&

If(Match(Month(DateNum),'Jan','Feb','Mar') > 0 , 4,

If(Match(Month(DateNum),'Apr','May','Jun') > 0 , 1,

If(Match(Month(DateNum),'Jul','Aug','Sep') > 0 , 2, 3))) AS Quarter,

MonthName(DateNum) AS Month_Year,

Day(DateNum) AS Day,

WeekDay(DateNum) AS WeekDay,

Year2Date(DateNum,0) AS ThisCalendarYTD,

YearName(DateNum,0,4) AS LastCalendarYTD,

Year2Date(DateNum,0,4) AS ThisFiscalYTD,

Year2Date(DateNum,-1,4) AS LastFiscalYTD

RESIDENT TempDate;

DROP TABLE DateRange;

DROP TABLE TempDate;

Anonymous
Not applicable
Author

Hi Neetha,

Find the original Datamodel in the application

Domain:

LOAD * INLINE [Domain_ID, Creation_Date_1, Updated_Date_1

];

Services:

LOAD * INLINE [Domain_ID,Service_Unique_id,Creation_Date_2,Updated_Date_2

];

Version:

LOAD * INLINE [Service_Unique_id,SLD_Unique_Id,Creation_Date_3,Updated_Date_3

];

SLA:

LOAD * INLINE [SLA_UId,SLD_Unique_Id,Creation_Date_4,Updated_Date_4

];

App_Ver:

LOAD * INLINE [SLA_UId,AV_ID,Creation_Date_5,Updated_Date_5

];

Buss:

LOAD * INLINE [AV_ID,Creation_Date_6,Updated_Date_6

];

  SLD:

LOAD * INLINE [SLD_Unique_Id,E_ID,Creation_Date_7,Updated_Date_7

];

   END:

LOAD * INLINE [E_ID,Creation_Date_8,Updated_Date_8

];

Anonymous
Not applicable
Author

hi ij,

Please can you copy paste source table dates format.

what are source table dates format : DD/MM/YYYY  (or) DD/MM/YYYY hh:mm:ss.

if DD/MM/YYYY hh:mm:ss ,format with below code in script for source table dates:


  Date(Floor(Fieldname)) as Fieldname

Regards

Neetha