# Custom fields in Windsor.ai

> How to create calculated metrics, rename fields, and apply formulas using Windsor.ai's custom fields feature.

Custom fields let you create new calculated metrics and dimensions based on existing fields in your Windsor query. You can build margin-adjusted cost figures, rename fields for display, combine string fields, or create conditional logic.

## What you can do with custom fields

- **Calculated metrics**: create a custom ROAS by dividing revenue by cost, or a blended CPA across channels.
- **Margin adjustments**: multiply spend by a margin factor per channel or campaign to report adjusted costs.
- **Field renaming**: rename a source field to a friendlier display name in your destination.
- **Conditional logic**: create a field that returns different values based on another field's value (for example, tier labels based on spend thresholds).
- **String manipulation**: combine first name and last name fields, extract parts of a campaign name, etc.

## Creating a custom field

1. In the Windsor query builder, click **Custom Fields** (or the equivalent field editor).
2. Click **Add custom field**.
3. Enter a name for the new field.
4. Enter the formula using Windsor's formula syntax (see below).
5. Save the custom field. It appears in your field list and can be selected like any other field.

## Formula syntax

Windsor custom fields use a spreadsheet-like formula syntax:

```formula
{cost} / {conversions}        — CPA
{cost} * 1.15                 — cost with 15% margin
IF({campaign} = "Brand", {cost} * 0.9, {cost})   — conditional margin
CONCAT({source}, " - ", {medium})                 — string combination
ROUND({roas}, 2)              — round to 2 decimal places
```

Refer to field names by wrapping them in `{}`. Available functions include arithmetic operators, `IF`, `CONCAT`, `ROUND`, `UPPER`, `LOWER`, and others.

## Applying channel-specific margins

A common use case is applying different margin multipliers per channel. See [How to add margins to different channels or campaigns using Custom Fields](https://windsor.ai/documentation/troubleshooting/how-to-add-margins-using-custom-fields.md) for a full worked example.

## Migrating custom fields from other tools

If you have calculated fields in Funnel, Adverity, or Supermetrics that you want to recreate in Windsor, see [Migrating custom fields from Funnel, Adverity, or Supermetrics to Windsor.ai using Claude](https://windsor.ai/documentation/troubleshooting/migrating-custom-fields-with-claude.md). Claude can check field names against your connectors and create the custom fields automatically.

## Troubleshooting

- [How to add margins using Custom Fields](https://windsor.ai/documentation/troubleshooting/how-to-add-margins-using-custom-fields.md)
- [Migrating custom fields with Claude](https://windsor.ai/documentation/troubleshooting/migrating-custom-fields-with-claude.md)
- [Understanding aggregatable vs. non-aggregatable metrics](https://windsor.ai/documentation/troubleshooting/aggregatable-vs-non-aggregatable-metrics.md)
