This should be added as a part of the workflow post-action of a given transition (e.g. on "Done").
There are two approches there:
- numeric fields + formula
- eg: The integer field [overdue by] is set to [=end_date - due_date]
- list field + condition
- eg. The list/checkbox field [post-mortem] is set to [late] when [end_date] [>] [due_date]
In both cases, a special care should be taken to the order of conditions are fields might get a value by another post action of the same transition.