Master calendar
As a best practice, it is always better to keep time-related fields in a separate table outside of the fact table. This is particularly helpful when you want to see all the dates, and not just the dates when specific events occurred. In our case, we should be able to see all the dates, and not just the dates when an order was made, because in real-life scenarios there may be days or months in which no order was made. It is also important to remember that QlikView stores dates as numbers:
Use the same QVW file
QlikViewEssentials_Chap4_LinkTable.qvw
.Invoke the script editor. Navigate to the Orders Tab. Go to the load script of
Orders
and comment theMonth
field by using//
. We will be creating this field in the master calendar.Create a new tab after the LinkTable tab and name it
Master Calendar
.Get min and max dates. Create a new table
GetDateRange
and load min and max dates from theFacts
table. QlikView stores dates as numbers. You can subtract the dates by converting numbers...