Databases Reference
In-Depth Information
We can compare the result from both expressions in this screenshot. A higher result
in the
Direct Load Factor %
column means the low-occupancy routes have just a few
flights that don't affect the overall result. However, the impact of those routes can
still be seen in the
Avg Load Factor per Route
column since that's where all routes
are equally accounted for, no matter the amount of flights performed.
For each
Dimensionality
level, the chart depicted earlier is using a different sub-
aggregation to calculate the average load factor per route. Additionally, when
Dimensionality
is zero (the total row at the bottom), the chart is calculating the
average for all routes, all carriers, and all flight types. We used
Dimensionality() +
1
as the
n
parameter of the
Pick
function because otherwise there would be no way
of adding an expression for when
Dimensionality()
equals zero.
Since the expression's definition is based on a certain, predefined,
arrangement of the dimensions in our pivot table, we must be cautious
when using an expression like this because it will yield unexpected results
when the dimensions are re-ordered by the user (for by dragging the
corresponding columns).
A tip on copying expressions
We will close this chapter on advanced expressions by sharing a tip that can save
you quite some time when developing QlikView documents. You have noticed
that, when defining a chart's expressions, we not only define the formula, but also
expression attributes, number format, presentation, labels, alignment, and so on. It is
very common that, when using more than one expression in a chart (a straight table,
for instance), two or more of these expressions are very similar in terms of formatting
and sometimes also in the formula itself.
In those cases, we can simply copy and paste an expression within the
Expressions
tab of the
Chart Properties
window to replicate the entire expression definition and
then adjust whichever parameters or definitions we need to, thus saving a great deal
of time and work.