Using the Declare and Derive functions to generate Calendar fields
Defining a master calendar in Qlik Sense is a common requirement, and can be done using the Time
and Date
functions. With Sense, Qlik has introduced the Declare
and Derive
functions, which make it easier to create the Calendar
definition. This is still not commonly used, as most Qlik Sense developers stick to their old calendar scripts, and there is nothing wrong with that. However, these functions are worth exploring.
Getting ready
Load the following part of the script, which gives information on organization sales, into the Qlik Sense application:
OrgSales: LOAD Product, OrderNo ,DATE(Date#( InvoiceDate,'DD/MM/YYYY')) as InvoiceDate, Sales INLINE [ InvoiceDate,Product,OrderNo,Sales 1/1/2013,Chains,101,5500 8/2/2014,Seats,101,4800 3/3/2014,Brake Oil,102,6500 9/5/2015,Helmets,104,4500 ];
How to do it…
Using the INLINE
table specified in the preceding code, we will generate a master calendar. We will generate the fields...