Databases Reference
In-Depth Information
•
Sum({$<Year = {"20*"}>} [# Departures Performed])
This will use a record set based on current selections (
$
) where the
Year
matches the search string
"20*"
, meaning all years that begin with
20
will be
taken into account.
•
Sum({$<Year = {">=2010"}>} [# Departures Performed])
This will use a record set where the
Year
is greater than or equal to
2010
to calculate the number of flights. A search string is used in the field
value definition.
•
Sum({$<[Carrier's Operating Region] = {'Domestic', 'Latin
America'}, Year = {2010}>} [# Departures Performed])
This will use a record set based on the current selections where the
Carrier's Operating Region
field is either
Domestic
or
Latin America
,
and only those records corresponding to the year
2010
.
Notice how two elements in the field value definition have been separated
by a comma.
•
Sum({1<[Carrier's Operating Region] = {'Domestic', 'Latin
America'}, Year = {2011}>} [# Departures Performed])
In this expression, the only difference from the preceding example is the
use of the number
1
as the set identifier. The calculation will use the entire
document record set as a starting point, disregarding all user selections,
but take into account only those records where the
Carrier's Operating
Region
is either
Domestic
or
Latin America
, and will only look at those
records corresponding to the year
2011
.
•
Sum({$<[Carrier's Operating Region] = {'Domestic', 'Latin
America'}, Year = >} [# Departures Performed])
In this expression, there is no modifier value assigned to the field
Year
. The
calculation will use a record set initially based on the current selections, but
disregard the selections made in the
Year
field, and where the
Carrier's
Operating Region
is either
Domestic
or
Latin America
.
Internally, QlikView evaluates the field value definitions in Set Analysis in the same
manner as conditional expressions are evaluated (but usually faster), to determine
if a specific record should be part of the calculation or not. Therefore, the same rule
discussed previously about numeric versus text-based comparisons applies for
Set Analysis. That rule: using a set modifier based on a text-based field (
Month =
{'Jan'}
, for instance) is slower than using its numeric equivalent (
MonthNum= {1}
).
Similarly, it's also important to consider that, when defining a numeric comparison
value, it shouldn't be enclosed in single-quotes (
MonthNum = {'1'}
) as it will cause
QlikView to treat it as a text-based comparison.