There are a few points about the steps we used that you will want to take note of:
• Enclosing the expression in parentheses: As we want to make sure that the expression always gets calculated in the right order, we enclose it in parentheses. Imagine, for example, we had an expression vExample containing 10 + 5 without parentheses. If we were to use that variable in an expression containing a fraction, for example, $(vExample) / 5, the wrong result would be returned (11 instead of 3).
• Not prefixing the variable expression with an equals sign: When the expression in a variable definition is prefixed with an equals sign (=), the variable gets calculated globally. In our example this would mean that the Load Factor % value is calculated once for the entire data model. When used in a chart, all dimensions would be ignored and the expression would just return the same global value for each dimension. As we obviously do not want this to happen, in this example we do not prefix our expression with an equals sign.
• Dollar Sign Expansion: Enclosing a variable (or an expression) between a dollar sign and parentheses (Dollar Sign Expansion), as we did on the chart's expressions, tells QlikView to interpret the contents, instead of just displaying the contents. For example, $(=1 + 1) will not return the static text 1 + 1, but will return 2. We will look at Dollar Sign Expansion in more detail in Chapter 10, Advanced Expressions. For now, it's sufficient to note that, when referencing variables, we should use the Dollar Sign Expansion syntax in order for them to be interprete
status | not read | reprioritisations | ||
---|---|---|---|---|
last reprioritisation on | suggested re-reading day | |||
started reading on | finished reading on |