> For the complete documentation index, see [llms.txt](https://docs.dinmo.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dinmo.io/models/computed-fields.md).

# Computed Fields

Computed fields let you enrich a model with attributes that do not exist in its source data, without changing the original table in your data warehouse.

They help you transform existing values, summarize data from related models, create business classifications, or make a field from a related model available for an activation.

Once created, a computed field appears in the schema of its parent model. Depending on its type, it can be used in segments, previews, and activations.

## Types of computed fields

DinMo provides four types of computed fields:

| Type                                                             | Use it when you need to                                                                           |
| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| [Aggregated field](/models/computed-fields/aggregated-fields.md) | Calculate a value from multiple records in a related model.                                       |
| [Formula field](/models/computed-fields/formula-fields.md)       | Create a value by applying an operation to fields in the same model.                              |
| [Label field](/models/computed-fields/label-fields.md)           | Classify records into business-friendly categories using conditions.                              |
| [Related field](/models/computed-fields/related-fields.md)       | Map a field from a singular related model in an activation without adding it to the parent model. |

## Why use computed fields?

Computed fields help you keep source models focused on their purpose while making their data more useful for business use cases.

For example, you can:

* Calculate a customer's lifetime value from transaction data.
* Create a churn-risk label from existing scores and attributes.
* Calculate a future date from an existing date.
* Map a product attribute in a transaction activation without duplicating product data in the Transactions model.

## Choose between live and materialized fields

Computed fields can be live or materialized.

A **live** computed field is recalculated each time it is used. Choose this option when freshness is the priority, especially when your warehouse data is updated in real time or when the field is used in an activation.

A **materialized** computed field is calculated in advance and stored in your data warehouse with its parent model. Choose this option when the calculation is complex, when the field is used frequently, or when you need stable and performant results for segmentation.

| Consideration                                                    | Recommended mode |
| ---------------------------------------------------------------- | ---------------- |
| The warehouse is updated in real time and freshness is essential | Live             |
| The field is primarily used in an activation                     | Live             |
| The calculation is complex                                       | Materialized     |
| The field is used frequently in segments or previews             | Materialized     |
| Segmentation requires predictable performance and stable results | Materialized     |

{% hint style="info" %}
The right choice depends on the use case: materialize a field to improve performance and stability for segmentation; keep it live when freshness is most important for activation.
{% endhint %}

## How to use a computed field

### Use a live computed field

A live computed field is calculated at the time it is used. You can use it to:

* Preview current values in a model.
* Map current values in an activation.

Because the field is recalculated on demand, it reflects the latest data available in the parent model.

Related fields are live fields. They are designed for activation mappings and are not available in the Segment Builder.

### Use a materialized computed field

A materialized computed field is updated with the materialization of its parent model. You can use it to:

* Build segments that need stable and performant calculations.
* Preview a consistent snapshot of the field.
* Map the value in an activation after the latest materialization run.

The field is refreshed according to the materialization schedule of its parent model. For more information, see [Model materialization](/models/overview/model-materialization.md).

## Manage computed fields safely

Changes to a computed field are reflected across the workspace. Renaming a field does not affect objects that use it, but changing its type or deleting it can affect segments, activations, or other dependent objects.

Before applying a change, review the impacted objects listed by DinMo.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.dinmo.io/models/computed-fields.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
