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

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
ss2q
Contributor III
Contributor III

How to make a master calender for this

I want to make a master calendar so when I choose Year as filter and choose 2022 it should pick results for that year from two tables and show.

I have two files called Invoice and Order and the common field between them is Order Number. It's Order_No in the invoice file and ORDER_NUMBER in the order file. I created their relationship with the data manager but I don't know how to make the master calendar and how to use it.

I extracted the year from GL_DATE from the invoice file and the year from ORDERED_DATE from the order file but for my analysis, I want to use GL_DATE year as my filter and it should automatically match with ORDERED_date year.

So, I will be grateful if someone can tell me how to do it in step by step.

2 Replies
Antoine04
Partner - Creator III
Partner - Creator III

Hello,

What you need to do is create a common calendar for both dates.

It exists several solutions for it. Attached you will find the Qlik doc with the best practices.

Hope it helps.

Regards,

Antoine L

Pablo007
Creator
Creator

Hi @ss2q ,

 

You shoud create and script as master calendar,  there are several models that you can copy paste

 

Here you can find some options

Solved: How to Create Master Calendar ? - Qlik Community - 103109

or you can use below one

On main add like this (sorry is in Spanish but you can change it at your convienience:

Pablo007_0-1709195666867.png

 

Pablo007_1-1709195764191.png

 


Set Hoy=Today();
Set FechaInicioCarga=YearStart(addYears($(Hoy), -5));

 

then create a new section :New script "Calendario"

Pablo007_2-1709195784380.png

 

Unqualify 'Fecha';
Unqualify 'DiaFecha';
Unqualify 'MesFecha';
Unqualify 'AñoFecha';


Calendario:
LOAD DISTINCT
date($(FechaInicioCarga)+RecNo()-1) as #Fecha,
date($(FechaInicioCarga)+RecNo()-1) as Fecha,
Day(date($(FechaInicioCarga)+RecNo()-1)) as DiaFecha,
Month(date($(FechaInicioCarga)+RecNo()-1)) as MesFecha,
Year(date($(FechaInicioCarga)+RecNo()-1)) as AñoFecha
AutoGenerate YearEnd($(Hoy))-$(FechaInicioCarga)+0
// AutoGenerate ($(Hoy))-$(FechaInicioCarga)+365
;

Then you can make a relationship between new Calendario Table and yours