Finding min and max

One of the standard pieces of script that tends to be used over and over again is the creation of a Master Calendar table. The first stage of this is to find the date range, from minimum to maximum, from your fact table and create all the possible days in between. In fact, this is even part of the main QlikView Developers' training course. We looked at this in Chapter 5, The Right Data Model Pays Dividends, when we created our Data Island.

The normal way to find the minimum and maximum dates is to use a piece of script such as this:

TempDates: LOAD Min([Order Date]) as MinDate, Max([Order Date]) as MaxDate Resident SalesOrders; LET varMinDate=peek('MinDate',0,'TempDates'); LET varMaxDate=peek('MaxDate',0,'TempDates'); DROP Table ...

Get QlikView Unlocked now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.