Databases Reference
In-Depth Information
This expression will go back two records in the currently-being-read table, take the
value on the
Date
field and use it as a result of the expression.
Or take this other expression:
Peek('Date', 2)
In this expression instead of "going back" two records, we will take the value in the
Date
field from the third record from the beginning of the current table (counting
starts at zero).
We can also add a table name as the third parameter, as in the following expression:
Peek('Date', 0, 'Budget')
This expression will return the value that the
Date
field stores on the first record in
the
Budget
table.
Merging forces
On their own, the
Order By
statement and the
Peek
function are already powerful.
Now, imagine what happens when we combine both of these tools to enhance
our input data. In this section, we will use both of these functions to add a new
calculated field to our
Employment
table (the one we integrated to our data model in
Chapter 8
,
Data Modeling Best Practices
).
A refresher
The
Employment
table provides information regarding the monthly number
of employees per airline. The total number is split between part and full time
employees, and it also shows the total
FTE
s (
Full Time Equivalent
).
The objective
The executives of HighCloud Airlines have asked the QlikView team to create a
report that shows the monthly change in number of employees in a line chart to
discover and analyze peaks in the employment behavior of each airline.