Using expressions in visualizations
Visualizations in Qlik Sense are built from charts, which in turn, are built from dimensions and measures, depending on the type of chart. Visualizations can have titles, subtitles, footnotes, and other elements to help convey information. All of the elements that make up a visualization can be simple: a dimension consisting of a field representing data, a title consisting of text, for example.
For visualizations that contain measures, the measures are aggregations based on fields. Specifically, the measures are calculations that span multiple records. For example Sum(Cost) means all the values of the field Cost are aggregated using the function Sum. In other words, Sum(Cost) is an expression.
What is an expression?
An expression is a combination of functions, fields, and mathematical operators (+ * / =), and other measures. Expressions are used to process data in the app in order to produce a result that can be seen in a visualization. They are not limited to use in measures. You can build visualizations that are more dynamic and powerful by using expressions for titles, subtitles, footnotes, and even dimensions.
This means, for example, that instead of the title of a visualization being static text, it can be made from an expression whose result changes depending on the selections made.
Where can I use expressions?
Expressions can be used in a visualization wherever the symbol is seen in the properties panel while editing a visualization. The symbol indicates an expression field. By clicking , you enter the expression editor, which is designed to help you build and edit expressions. Expressions can also be entered directly into the expression field, without using the expression editor.
An expression cannot be saved directly as a master item, but if an expression is used in a measure or dimension, which is then saved as a master item, with its descriptive data, such as name, description, and tags, the expression in the measure or dimension is preserved.
Expressions are used both in scripts and in chart visualizations. They can be simple, involving only basic calculations, or complex, involving functions fields and operators. Expressions can be used in several different situations. The difference between measures and expressions is that expressions have no name or descriptive data.