Expressions
See also: Analysis View , Examples of Expressions , Expression Builder , TimeSeries Wizard , Expression Elaboration , Specifying Excel File and Range Parameters, Referencing Results in Expressions
LEAP borrows an approach made popular in spreadsheets: the ability for users to enter data and construct models using mathematical expressions. Expressions are mathematical formulae used to specify the values of variables in LEAP's Analysis View. In Current Accounts an expression defines the historical values for a given variable at a branch , while in scenarios, the expression defines how that variable changes over time from the First Scenario Year to the End Year of the study period.
Expressions can range from simple numeric values to complex mathematical formulae. Each formula can optionally use LEAP's many builtin functions as well as referencing the values of other data and results variables. Expressions can also dynamically reference the values stored in an external Excel spreadsheet.
LEAP provides a number of ways of editing expressions. The most common are:

Typing directly into the expression field in one of the data entry tables in LEAP's Analysis View, or using the Expression Builder tab, in the lower half of the Analysis View screen.

Selecting one of the commonly used functions: Interpolation (), Growth (), EndYear (), or Remainder ()using the popup selection box attached to each expression field and marked by the button.

Using the TimeSeries Wizard (Ctrl+T or ): a tool for easily entering timeseries functions (Interpolation, Step, Smooth functions, and forecasting functions)

Using the Function Wizard: (Ctrl+F or ) a tool that helps you add functions into your expressions and complete the required parameters for each function.

Using the Branch/Variable Wizard (Ctrl+B) a tool that lets you create a reference to another branch and variable as well as specifying units and filters (for references to Results variables).
Understanding Expression Inheritance
Nearly all data in LEAP are specified as expressions for a given variable at a given branch in the LEAP tree. These expressions are entered in LEAP's Analysis View and different expressions can be entered for different scenarios (or for different regions in a multiregion area). To minimize data entry requirements and to make data management as easy as possible, scenarios are organized in a hierarchy so that you need only enter data in one scenario if it differs from the data entered in its parent (ancestor) scenario. Before describing the scenario manager, it is important to first understand the way that expression inheritance works in LEAP since this is fundamental to understanding how scenarios help you manage data. See Understanding Expression Inheritance for more information.
To reset an expression back to its inherited default, highlight the expression and press Delete, or rightclick and select the Reset to Inherited () option. .
Creating Models by Referencing Other Variables in Expressions
In addition to using expressions to directly specify data, you can also create expressions that refer to the values of other variables in LEAP. In this way you can create your own models that include both exogenous (externally specified) data and endogenous (internally calculated) variables.
You can reference both data variables and results variables. Data variables are those that are specified directly in LEAP's Analysis View through LEAP's expressions. Results variables are the additional values calculated internally by LEAP. Results variables include values such as total final energy demand, total emissions or total costs, as well as many other types of results.
Because they are calculated internally, in general, you can only reference results that were calculated in a previous year. This is done by using the PrevYearValue function to reference a past value of a result variable. An exception is when specifying calculated Indicator variables. Because these are calculated after LEAP's main calculation routines they may include references to the presentyear value of results variables.
You can create references to data variables by dragging and dropping items from the Analysis View tree into the Expression Builder, by using LEAP's builtin code completion features, or by using the Branch/Variable Wizard (Ctrl+B).
For more information on how to create references to other variables, see these two pages:
Expression Elaboration ()
Expression Elaboration is a feature that elaborates the various branches and variables upon which the current expression depends. Expression elaboration is implemented as a tab on a panel under the main data entry table in Analysis View to elaborate complex expressions. Expression Elaboration is useful for helping you to understand and explain your analyses without continually having to navigate from branch to branch in the tree. You can disable Expression Elaboration by rightclicking within the Analysis View data entry table and choosing Expression Elaboration.
Expression Elaboration shows the branches and variables upon which the current expression depends, and also lists the branches, variables and scenarios that depend on the current branch. Doubleclick one of the listed items to jump directly to that branch and variable.