Working With Calculated Fields
When you define calculated fields, keep the following in mind.
• Specify data types that are appropriate for the resulting calculated values. For example, to concatenate two string fields, specify the String or Text data types. Or, for a field that stores price or tax information, specify the Currency data type. For a field that stores item totals or numbers of days, specify the Integer data type.
• Custom logic is calculated inside records, which means all the fields within the record being created or updated can be used for calculation.
• In the logic you write, you can use the import keyword to include standard libraries, such as JodaTime, which is used to perform date and time calculations.
For more information: