Calculated fields are a powerful addition; they can be used in many scenarios, some of which are:
- Number calculations, (for accounting, weights, and so on)
- Retrieving values from related entities
- Constructing a string based on other attributes
The TechNet article (https://technet.microsoft.com/library/dn832103.aspx) covers calculated fields in a few examples. The article also covers some limitations of calculated fields. Among them are the following:
- Calculated fields cannot trigger a plugin or workflows
- Once a field is created as simple, you cannot convert it to a calculated field without deleting it; (something to consider when upgrading old versions)
- A calculated field cannot reference itself, but it can reference another calculated field or rollup field (limit of five chained fields)
- Values in the calculated formula can come from the current entity or a direct parent (no access to 1:N or N:N entities)
- Up to 10 unique calculated fields can be used in saved queries, charts, and visualizations
- You cannot define a maximum or minimum metadata property on a calculated field
At the time of writing, in addition to basic arithmetic operations, the Dynamics 365 supports the following built-in formulas with their respective return types:
Function syntax |
Return type |
ADDDAYS (whole number, date and time) |
Date and Time |
ADDHOURS (whole number, date and time) |
Date and Time |
ADDMONTHS (whole number, date and time) |
Date and Time |
ADDWEEKS (whole number, date and time) |
Date and Time |
ADDYEARS (whole number, date and time) |
Date and Time |
SUBTRACTDAYS (whole number, date and time) |
Date and Time |
SUBTRACTHOURS (whole number, date and time) |
Date and Time |
SUBTRACTMONTHS (whole number, date and time) |
Date and Time |
SUBTRACTWEEKS (whole number, date and time) |
Date and Time |
SUBTRACTYEARS (whole number, date and time) |
Date and Time |
DIFFINDAYS (date and time, date and time) |
Whole Number |
DIFFINHOURS (date and time, date and time) |
Whole Number |
DIFFINMINUTES (date and time, date and time) |
Whole Number |
DIFFINMONTHS (date and time, date and time) |
Whole Number |
DIFFINWEEKS (date and time, date and time) |
Whole Number |
DIFFINYEARS (date and time, date and time) |
Whole Number |
CONCAT (single line of text, single line of text, ... single line of text) |
String |
TRIMLEFT (single line of text, whole number) |
String |
TRIMRIGHT (single line of text, whole number) |
String |