Databases Reference
In-Depth Information
The fascinating thing about this chart is that when the user clicks one of the bars
corresponding to a specific interval, all carriers that fall into that interval will be
automatically selected. This selection would be made on the
Carrier Name
field, as
the
Load Factor %
bins do not exist as a field in the data model. This combination
of interactivity, associations, and complex calculations on the fly allows for further
navigation and extends the discovery experience.
The Pick function
Another interesting and powerful conditional function available in QlikView is
the
Pick
function. In a way, it can be said to act as a simplified nested
If
. The
parameters this function takes are:
Pick(n, expr1, expr2)
Where
n
is an integer number that determines which of the subsequent expressions
should be evaluated.
expr1
is an expression to be evaluated when
n
=
1
and
expr2
is
an expression to be evaluated when
n
=
2
The same result of the
Pick
function can be accomplished using a nested
If
;
for example:
If (n = 1, expr1, If(n = 2, expr2))
However, we can easily see that the
Pick
function is much simpler to use in this case
and can even be lighter in terms of resource usage.
The
Pick
function has no hard limit as to how many
expressions it can hold.
Let's look at a practical example.
Using Pick with Dimensionality
One of the examples we described using the
Aggr
function required us to make
a sub aggregation in the chart's expression to obtain the average load factor per
airline per route. In the example, we used only one chart dimension,
Airline
, and
the corresponding
Aggr
function only had two fields in the dimensions parameter:
Route
and
Airline
. However, the defined expression will not work as expected when
a new dimension is added to the chart.