Calculated columns are custom columns that you create (at design or run time) where the value is not in the underlying dataset but is dynamically derived from other cells in the row.
You create Calculated Columns via the Expression Editor where you can drag and drop the Columns and functions you need, or write the expression by hand.
Once created, a Calculated Column becomes a 'normal' column in your grid and will update automatically as other values change. (See this video for more details. )
In this example we have created 6 Calculated Columns:
- Avg Item Cost - (numeric) which divides ItemCost by ItemCount
- Profit - (numeric) which calculates Invoiced Cost minus sum of Order Cost and Package Cost
- Comment - (a string) which returns 'Low' if ItemCost is less than 50, 'Medium' if greater than 50 and 'High' if greater than 100.
- Highest Cost - (a number) which returns the largest of ItemCost, OrderCost, InvoicedCost and PackageCost (the latter being first multiplied by 10)
- ShipDelay - (a boolean) which returns true if ShippedDate is 4 days later than theOrderDate (we add it to CheckboxColumns in User Interface Predefined Config for better visualisation).
- Tax - (a string) which returns the VAT (calculated at 20%) on OrderCost and to which we've added a Display Format
Click the 1st button in Dasbhoard to see details of the Expression - or 'Edit Expression' in the Column Header menu.
They are treated as 'normal' columns so we included them in the layouts we created (and we grouped on 'Comment') and we also styled them (e.g. 'Profit') using Conditional Styles.