Early Access: The content on this website is provided for informational purposes only in connection with pre-General Availability Qlik Products.
All content is subject to change and is provided without warranty.
Skip to main content Skip to complementary content

Creating a variable

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 dialog or in the script using the data load editor.

You can create a new variable from the variables dialog, when editing a sheet in an unpublished app.

You can duplicate an existing variable by clicking and selecting Duplicate.

For a visual demo about creating variables, see Creating a variable.

  1. When editing a sheet, click Variables in the edit bar on the sheet to open the variables dialog.

    The variables overview opens.

  2. Click Create new.

    The following input fields for the variable are displayed:

    • Name (mandatory)
    • Definition
    • Description
    • Tags

    Press Esc or click Cancel if you want to cancel creating the new variable.

  3. 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.

    • Do not use the following characters when naming a variable: $ ( ) [ ] "
    • The name must be unique. You cannot name a variable using a name used for a reserved variable or a system variable. These variables are not listed in the variables dialog, but if you are not allowed to use a certain name, even though you cannot find a duplicate in the variables dialog, 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.
  4. Optionally, type a description for the variable.

  5. Create a definition for the variable. You can enter the expression editor by clicking Expression.

    For more information, see Working with the expression editor.

    Example:  

    Set the variable's value to today's date, presented as a number: 

    Num(Today())

  6. Optionally, enter tags for the variable.

  7. Optionally, select Include in bookmarks if you want the current variable value to be included when a user creates a bookmark.

    For more information on variables and bookmarks, see Including variable states in bookmarks and reports.

  8. Click Create to save the variable.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!