A variable in Qlik Sense is a named entity, containing a data value. When a variable is used in an expression, it is substituted by its value or the variable's definition. Variables are defined using the variables overview or in the script using the data load editor.
You can create a new variable from the variables overview, when editing a sheet in an unpublished app.
Do the following:
When editing a sheet, click in the edit bar on the sheet to open the variables overview.
The variables overview opens.
Click Create new.
The following input fields for the variable are displayed:
- Name (mandatory)
Press Esc or click if you want to cancel creating the new variable. If all input fields are empty, you can also cancel by clicking outside the new variable section in the variables overview or by clicking outside the variables overview window.
Type a name for the variable (mandatory). Use the following guidelines when choosing a name:
- You cannot change the name once you have created the variable.
- Use a letter as the first character, do not use a number or a symbol.
It is not recommended to name a variable identically to a field or a function in Qlik Sense.
For more information, see How names are interpreted.
- Some characters have specific uses in Qlik Sense expressions, therefore do not use the following characters when naming a variable: $ ( ) [ ] "
The name must be unique. You are not allowed to name a variable identically to a reserved variable or a system variable. These variables are not listed in the variables overview, but if you are not allowed to use a certain name, even though you cannot find a duplicate in the variables overview, a reserved variable or a system variable already has this name.
- A long name is not recommended. If a variable's name is too long, the name cannot be fully displayed in the variables overview.
Create a definition for the variable (optional). You can enter the expression editor by clicking .
For more information, see Working with the expression editor.
Set the variable's value to today's date, presented as a number:
Type a description for the variable (optional).
Add tags by typing and click or press Enter (optional).
Save the variable by clicking @. You can also save by clicking outside the new variable's section in the variables overview or by clicking outside the variables overview window.
The variable is added to the top of the list and marked with New.
The new variable is created.