When you need to derive a piece of data using rules, such as a formula or a sum, you define these rules and attach them to a specific column of a table, where that data will be persisted.
This is usually the most efficient way to go, but it does require that you have control over your database schema.
In cases where you may not have control over the schema, i.e. you can't create new column, you may have to use non-persistent attributes.
Non-persistent attributes are pseudo-columns that you can add to the schema without affecting the database schema.
Once you have defined such an attribute, you can treat it (mostly) like a regular column: it can be part of resources, and it can (mostly) be used in rules. There are, however, some important limitations:
Non-persistent attributes are far more performance-intensive than persistent attributes