Standard Calculated Columns
Summary
- Standard Calculated Columns show a value that is derived using other cell values in the same row
- It can include as many Expression Functions and clauses as needed
The Expression provided by a Calculated Column is most commonly a Standard Expression.
This evaluates each row in turn and returns a single value of any type.
The evaluation for a Standard Calculated Column value is typically derived dynamically, using the values in other cells of the same row.
Note
- There is no limit in the number of Expression Functions which can be included in a Calculated Column's Expression
- The Expression will update in real time as values in referenced columns change
Find Out More
- See Expressions to learn more about AdapTableQL, expression syntax, and the available functions
- Consult the Standard Expressions topic for detailed information
Basic Expression
Most Calculated Column Expressions contain just one clause and uses the standard operators ('=', '>' etc.)
A very typical example is returning a mathematical evaluation on a few inputs.
- This example has two Calculated Columns (using Standard Expressions):
Subscribers Ratio- divides Github Stars by Github WatchersTotal PRssums Open PRs and Closed PRs
Expand to see the Calculated Column Definitions
Create a new Calculated Column that calculates how many days passed since a row was last updated
Complex Expression
However it is possible to create more complex Calculated Columns.
These can either include multiple clauses or it can leverage some of the more powerful Expression Functions.
It is also possible to reference Custom Expression Functions in a Calculated Column Expression.
Hint
Any value can be returned in a Calculated Column (i.e. date or string or boolean) and not solely a number
Logic in Expressions
Calculated Column Expressions can also include logic functions if required.
These can take 2 forms:
-
ternary logic, ie. if X, then Y, else Z
[Comments] > 100 ? 'Big' : [Comments] > 50 ? 'Medium' : 'Small' -
case statements, where different values are evaluated:
CASE WHEN [price] < 10 THEN 'low' WHEN [price] < 50 THEN 'medium' ELSE 'high' END
- This demo contains 5 Calculated Columns which each contain a Standard Expression (of varying complexity and with varying Data types):
Years Old- calculates how many years passed since each framework repo was created - returns a NumberIssues Open/Total Ratio- shows ratio between open and total number of issues - returns a NumberPR Open/Total Ratio- shows ratio between open and total number of pull-requests - returns a NumberPopularity- specifies the popularity taking into account the number of stars using ternary logic - returns a StringAnniversary- adds 1 year to the Created Date column - returns a Date