Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jonesbrown
Creator
Creator

How to Create Master Calendar ?

Hi All,

I am new to Qlikview

How to Create Master Calendar ?

Please Help.

18 Replies
Hania
Creator
Creator

Hii

//-------------------------------------------1 step-------------------------------------------------------//
// create table and extract min and max date
// define Min Max Date
min_max:
Load

Min(Delivery_Date) as minDate,
Max(Delivery_Date) as maxDate

Resident SALESDETAILS;

//-------------------------------------------2 step-------------------------------------------------------//


// create variable and peek dates of min max from loaded table (min_max)
Let vMinDate = Peek('minDate',0,'min_max');

Let vMaxDate = Peek('maxDate',0,'min_max');

//after fetching min max dates from min_max --> no use of it so drop table
drop table min_max;

//-------------------------------------------3 step-------------------------------------------------------//

// creating master calendar & Extract all the necessary date columns required for the dashboards between min and max
Master_Calendar:
Load

MonthName(Delivery_Date) as MonthName,
QuarterName(Delivery_Date) as QuarterName,
YearName(Delivery_Date) as YearName,
'Q'&Ceil(Month(Delivery_Date)/3) as Quarter,
Year(Delivery_Date) as Year,
Month(Delivery_Date) as Month,
WeekDay(Delivery_Date) as WeekDay,
Week(Delivery_Date) as Week,
Day(Delivery_Date) as Day,
Year(Delivery_Date) as yearDate,
'HY'&Ceil(Month(Delivery_Date)/6) as HalfYear

;
//-------------------------------------------4 step-------------------------------------------------------//

//looping--> from minimum date till maximum date rech
Load

Date($(vMinDate) + IterNo() - 1) as Delivery_Date

AutoGenerate 1

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

Hope this helps,

help user find answers ! don't forget to mark  a solution that work for you and click the like button!

My_Rebecca
Creator
Creator

No matter how, I do appreciate your reply. I would check and mark as solution if feasible.

My_Rebecca
Creator
Creator

Dear @Hania , do your script support cross-period selection? For example, if I filter January and March, could this expression result is calculated from the total days of January & March (62 days), not from the beginning of January to March (90 days)? From your script, I do not see anything special about this point. As I have tried your similar method before, it does not work.

My expression:

Count(distinct(GI_Delivery & [GI_Delivery Item]))/(7*8*(NetWorkDays('$(=vProductivity_MinDate)','$(=vProductivity_MaxDate)')

Hania
Creator
Creator

Hi,

You should add Filter for month & date picker as well based on your requirement so you can select your desirable months and if you want to view data based on specific Date/Random date you can visualize  with ease.

Hania_0-1681367307710.png

 

Hania_1-1681367457114.png

As you can see it work based on selection.

My_Rebecca
Creator
Creator

Dear @Hania , thanks for your reply. Easy selecting month and date is not the problem, but expression is not easy to reach. please focus on my expression and look forward to your reply.

 

For example, if I filter January and March, could this expression result is calculated from the total days of January & March (62 days), not from the beginning of January to March (90 days)? From your script, I do not see anything special about this point. As I have tried your similar method before, it does not work.

My expression:

Count(distinct(GI_Delivery & [GI_Delivery Item]))/(7*8*(NetWorkDays('$(=vProductivity_MinDate)','$(=vProductivity_MaxDate)')

ss2q
Contributor III
Contributor III

How to create a master calendar and link it if I have two tables?

One is the Order table which contains Ordered_Date and another is the Invoice table which contains GL_date. From these date columns, I extract the Year from each of the tables. Like from the order table, I extract the year from the order date and in the invoice table I extract the year from gl_date. Now I want to create a master calendar by linking the year from both tables and using the master calendar Year in my analysis. Is it possible? What will be the code if someone can tell me and How can I relate to the data manager or something?

Ravi_Nagmal
Contributor III
Contributor III

ss2q
Contributor III
Contributor III

How about if I want make like this?

 

One is the Order table which contains Ordered_Date and another is the Invoice table which contains GL_date. From these date columns, I extract the Year from each of the tables. Like from the order table, I extract the year from the order date and in the invoice table I extract the year from gl_date. Now I want to create a master calendar by linking the year from both tables and using the master calendar Year in my analysis. Is it possible? What will be the code if someone can tell me and How can I relate to the data manager or something?

Hania
Creator
Creator

@ss2q In that case you can use Link Table .