Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Kwame
Contributor III
Contributor III

Issue with Master Calendar

This has been generated independently of the master calendar and is populating accurately.

Year(Date(MakeDate(year, quarter * 3 - 2), 'DD/MM/YYYY'))

Kwame_0-1709118323691.png

But once I try with the Year field derived from the master calendar, it appears somewhat scattered or sparse

Kwame_1-1709118422454.png

What could be the issue here?

7 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Can you post your expression using the derived field?

-Rob

Kwame
Contributor III
Contributor III
Author

Year(Date(MakeDate(year, quarter * 3 - 2), 'DD/MM/YYYY')) as YEAR

and the date field for my calendar;

Date(MakeDate(year, quarter * 3 - 2), 'DD/MM/YYYY') as %Date

/**************** Generate Calender ********************
CALENDER:
Load 
 Date(TempDate) AS %Date, 
 week(TempDate) As Week, 
 Year(TempDate) As Year, 
 Month(TempDate) As Month, 
 Day(TempDate) As Day, 
 'Q' & ceil(month(TempDate) / 3) AS Quarter, 
 Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear, 
 WeekDay(TempDate) as WeekDay,
 'Q' & Ceil(Month(Date(TempDate,'DD/MM/YYYY')) / 3)&'-' & Year(Date(TempDate,'DD/MM/YYYY')) as QuarterYear ;

//=== Generate a temp table of dates === 
LOAD 
 date(mindate + IterNo()) AS TempDate
 ,maxdate // Used in InYearToDate() above, but not kept 
WHILE mindate + IterNo() <= maxdate;

//=== Get min/max dates from Field ===/
LOAD
 min(FieldValue('%Date', recno()))-1 as mindate,
 max(FieldValue('%Date', recno())) as maxdate
AUTOGENERATE FieldValueCount('%Date');

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

It appears your CALENDAR table is not correctly linked to your fact table. What is the subset ratio (from Data Model Viewer preview) on both ends of the %Date field?

-Rob

Dhirendra_Kharwar__13373
Contributor II
Contributor II

Your Calendar Date and Fact Table Date are not linked properly. Check following points

1. Date format

2. Calendar creation method

3. If you are creating the date by min-max date then check the Min and Max date format.

Kwame
Contributor III
Contributor III
Author

Kwame_0-1709145084897.png

Kwame
Contributor III
Contributor III
Author

Script


/**************** Generate Calender ********************
CALENDER:
Load
Date(TempDate) AS %Date,
week(TempDate) As Week,
Year(TempDate) As Year,
Month(TempDate) As Month,
Day(TempDate) As Day,
'Q' & ceil(month(TempDate) / 3) AS Quarter,
Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear,
WeekDay(TempDate) as WeekDay,
'Q' & Ceil(Month(Date(TempDate,'DD/MM/YYYY')) / 3)&'-' & Year(Date(TempDate,'DD/MM/YYYY')) as QuarterYear ;

//=== Generate a temp table of dates ===
LOAD
date(mindate + IterNo()) AS TempDate
,maxdate // Used in InYearToDate() above, but not kept
WHILE mindate + IterNo() <= maxdate;

//=== Get min/max dates from Field ===/
LOAD
min(FieldValue('%Date', recno()))-1 as mindate,
max(FieldValue('%Date', recno())) as maxdate
AUTOGENERATE FieldValueCount('%Date');


SET DateFormat='DD/MM/YYYY';

Date(MakeDate(year, quarter * 3 - 2), 'DD/MM/YYYY') as %Date

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You have to select the %Date field to see the subset ratio. 

rwunderlich_0-1709158988592.png