Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
s_mapper319
Contributor II
Contributor II

Associate Master Calendar with other data tables

Hi there!

I was (finally) able to create a Master Calendar in the Script Editor; however, the loaded table is not visible when I go back to Data Manager. I want to associate the newly-created Master Calendar with all the other fact tables I already have in my data model, but don't know how to do that outside of Data Manager.

I can see the Master Calendar in the Data Model View, so I know it does exist. Based on other comments, it seems like it has to do with the order that tables are loaded in the Script Editor (my Master Calendar is loaded last); however, if I load the Master Calendar first, I'm unable to reference the fact table for the date range.

Any help greatly appreciated!

 

My code to create the Master Calendar:

MinMaxTable:
Load
Max(DygnDatum) as MaxDate,
Min(DygnDatum) as MinDate
Resident DygnVärden;

let vMax=num(peek('MaxDate',0,MinMaxTable));
let vMin=num(peek('MinDate',0,MinMaxTable));

Drop Table MinMaxTable;

TempCal:
Load
date($(vMin)+RowNo()-1) as X

AutoGenerate $(vMax)-$(vMin)+1;

MasterCalendar:
Load
X as Datum,
week(X) As Vecka,
Year(X) As År,
Month(X) As Månad,
Day(X) As Dag,
WeekDay(X) as Veckodag

Resident TempCal;

Drop Table TempCal;

Labels (5)
3 Replies
MayilVahanan

Hi @s_mapper319 

Rename the "Datum" field in master calendar similar to the Date field in the order table. 
For ex: Order table has date field named as "DygnDatum", then change the "Datum" to "DygnDatum".
Qlik will associate between those table based on the common field "DygnDatum".

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
s_mapper319
Contributor II
Contributor II
Author

Hi Mayil,

Thanks for the response! I actually have several tables with a date column that I would like to associate with the Master Calendar, and while they all have the name "Datum", they are also prefaced with the name of the table since you can't have identical column names (ex. Table1.Datum, Table2.Datum). 

An issue I run into in my visualizations is that a date filter applied to Table1 isn't applied to Table2 (for example, only show data on a Wednesday), which is what I want to have happen. So I thought that I could associate all the dates to a master table and visualize from that, but I haven't been successful in that yet.

th3vish
Contributor
Contributor

I think in your situation Conanical Date will help you.

for reference  : Canonical Date - Qlik Community - 1463578