Databases Reference
In-Depth Information
Numeric versus text comparisons
An important consideration when inserting comparisons into conditional functions is
that text-based comparisons will be slower than numeric comparisons.
Take the following two expressions, for example:
1.
If(Month = 'January', expr1, expr2)
2.
If(MonthNum = 1, expr1, expr2)
The only difference is that the first expression is comparing the Month value as a
literal value, that is, a text, while the second expression is performing the comparison
based on a numeric value. The latter will be faster.
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.
The Class function
Conditional functions are widely used in conjunction with numeric intervals either to
find where a specific value falls in a set of ranges, or to group results into predefined
bins. The Class function is particularly helpful in these cases.
Take, for example, the analysis we made in a previous section about the number of
interstate routes per carrier. The initial chart is:
We can group the carriers based on the number of interstate routes they serve, only
instead of using the individual number of routes, we can use intervals. Add the
following expression to our chart:
Class(Count(Distinct [From - To State Code]), 100)
 
Search WWH ::




Custom Search