# Fields

Fields reference either columns in the database (dimensions and dimension groups) or aggregates computed in a `group by` statement (measures or metrics). There are three types of fields `dimension`, `dimension_group`, and `measure` (we also refer to measures as metrics and use the terms interchangeably). For all fields, their `field_type` (one of the three just listed) is a required property.

* [Dimensions](/data-modeling/dimension.md) are references to columns in your database table. They can either reference each other or raw columns in the database.
* [Dimension Groups](/data-modeling/dimension_group.md) are a special type of dimension used for timeframes (referencing the same date column but having slices for it daily, weekly, monthly, etc), and for intervals (referencing the difference between two date columns and slicing it days between, weeks between, months between, etc).
* [Measures (or metrics)](/data-modeling/measure.md) are reference dimensions or raw columns in the database and specify an aggregate on those columns. They can also reference other measures and perform operations referencing each other post-aggregation. E.g. if you have a measure `total_gross_revenue` and a measure `total_discounts` you can define a new measure like this to calculate total net revenue.

```yaml
name: total_net_revenue
field_type: measure
type: number
sql: ${total_gross_revenue} - ${total_discounts}
```

There will be more examples of each type of field in their respective documentation pages.

Fields are defined in [view](/data-modeling/view.md) files.


---

# Agent Instructions: 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:

```
GET https://docs.zenlytic.com/data-modeling/field.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
