Creating and Editing Variables
Zuletzt aktualisiert am 03.03.2025
Overview
Variables are the building blocks of your models. If you're a spreadsheet user, you can think of them a bit like spreadsheet cells. If you're a programmer, you can think of them as, well, variables.
You can define a variable using a formula. Formulas let you work with numbers, ranges, and other variables.
Creating a Variable
To create a variable:
- Click New Variable at the end of a section.
Creating a new variable - The following drop-down menu is displayed:
Dropdown menu for a new variable - Do one of the following:
- Create a new variable: If you select this option, enter the name of the new variable in the input field.
- Create from data: Creates a new variable from a data item. If you select this option, you can first select the desired data source and then the desired variable. For more information on this topic, see Linking Variables to Integrated Data.
- Import variable: Reference a variable from a different model. If you select this option, you can first select the desired model and then the desired variable.
- If you have defined a new variable, you can then specify its format type by clicking on the
icon or the icon to the left of the variable name:
Choosing a data type for a variable
Format type
Description
Number
For quantities that aren't percentages or currencies.
Date
The number will be formatted as a date. You can enter the date as date(yyyy,mm,dd)
or as date(yyyy,mm)
.
Currency $
Choose a specific currency (e.g. USD), or select Custom if the currency is not listed (e.g. cryptocurrencies). The currency symbol for common currencies is pre-set from the currency you select (e.g. $ for USD), but you can manually change the prefix/suffix.
To learn more about Currency and how xP&A handles FX conversion, see Currency & FX Conversion.
Percent %
This expects the variable's value to be a decimal.
Example: 0.5 will be displayed as 50%. You can also enter directly as "50%".
Boolean
A variable that can be True or False (1 or 0), displayed as a checkbox/toggle.
Using Advanced Formatting Options
In addition to the standard formats, advanced formats can also be assigned to a variable. Proceed as follows to use the advanced formats:
- Click
to open the context menu.
- Click Format.
.
Context menu 'Format' - The context menu is displayed as follows:
Advanced format options - Choose the desired option (see Advanced formatting options).
Advanced Formatting Options
Option
Description
Human-readable
1,000 -> 1k, 1,000,000 -> 1m, etc. Human readable is automatically on.
Comma separators
Comma separators, i.e. 1000 -> 1,000, 10000 -> 10,000, etc. Comma separators are automatically on.
Zero as
Displays cells with 0 values as -, making it easy to spot cells that have non-zero numbers.
Negatives
Accounting negatives i.e. ($100,000) not -$100,000 Red negatives i.e. -$100,000 or both ($100,000)
Precision
Automatic, or specify the number of decimal places or significant figures.
Magnitude
Automatic (as entered), or specify the 'unit' (thousand, lakh, million, crore, billion, trillion) you want to display the value in. For example, if you entered 100 but format the display as 'thousand', this will be 0.1k.
Relative time
Activate to use relative time for the variable. For more information, see Relative Time for Variables.
Lower is better
Activate if in comparisons values of the variable shall be displayed in green if they are lower than the vakues they are compared with.
Adding a Custom Prefix and/or Suffix (Custom Units) to a Variable
You can set custom unit format for your variables, and set whether that unit is displayed before or after the number (prefix vs. suffix).
To add a prefix and/or a suffix:
- Click
to open the context menu.
- If necessary, use the dropdown menu to switch to prefix or suffix.
Add suffix and/or prefix to a variable - Enter the desired prefix or suffix in the input field.
This gives you ultimate flexibility to visually distinguish the units of variables in your models (e.g. currencies, earnings multiples, ratios, time units etc). Note that custom units are purely visual and do not affect calculations whatsoever.
Types of Variables

Green variables are variables that are coming from a linked model. If you hover over the variable you can see which model it is coming from.

Purple variables are Causal's special helper variables, e.g. today, none, date / timestep, cohort.