> ## Documentation Index
> Fetch the complete documentation index at: https://docs.invoca.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom Marketing Data: Formula Configuration

> Formula Fields let you calculate new Marketing Data using Excel-like functions — currently used to categorize your Marketing Channel field based on UTM data.

<Note>
  Invoca is migrating Dashboards and Reports to the newer Insights & Analytics experience. See [Insights & Analytics: Getting Started Guide](/s/article/insights-analytics-getting-started-guide) to check out the new experience.
</Note>

## Overview

Formula Fields calculate new data by referencing or transforming existing Marketing Data Fields or Signals. Using a syntax similar to Excel, you can apply Invoca or custom functions to enrich your dashboards and reports.

**Note:** Formula-based functionality is currently limited to categorizing your Marketing Channel field, calculated on a per-call basis — it doesn't support multi-row or aggregate calculations, like totals across multiple calls.

## Editing a Formula Field

You must be a Super User to edit a Marketing Data Field. Initially, you can only edit fields Invoca has already attached a default formula to — look for the `(f)` icon on the Marketing Data Dictionary page.

1. Click **Settings**, then **Marketing Data**.
2. Find the field you want to edit (marked with an `(f)` icon) and click its **Edit** icon.
3. Scroll to the **Formula (optional)** section and click **Edit and Preview** to open the formula editor.
4. Make your changes in the formula input box.
5. Click **Refresh** to preview how your changes affect the data, shown in the Preview with call data table.
6. Click **Apply** to save your edits and return to the Edit Marketing Data Field page, or **Cancel** to discard them.
7. Click **Save** on the Edit Marketing Data Field page to finalize your changes — they won't take effect until you do.

## Supported Data Types

| Invoca Feature | Data Type | Description | Example Reference |
| :- | :- | :- | :- |
| Marketing Data Fields | Short Text, Category | Referenced by Partner (API) Name; defaults to an empty string if no value present | `utm_medium` |
| Invoca Reporting Fields | Short Text, Category | Referenced by Invoca Reporting Field Name; defaults to an empty string if no value present | `invoca.media_type` |
| Signals | Boolean | Referenced by name (use backticks around names with spaces or punctuation); defaults to False if no value present | `` `Answered by Agent` `` |
| Scores | Integer | Referenced by name (use backticks around names with spaces or punctuation); defaults to 0 if no value present | `` `Sentiment Score` `` |

Long Text fields (such as URLs) aren't supported in Formula Fields.

## Available Functions

| Name | Description |
| :- | :- |
| `ABS` | Returns the absolute value of a number |
| `AND` | Returns TRUE if all arguments are TRUE |
| `AVERAGE` | Returns the arithmetic mean of its arguments |
| `CEILING` | Rounds a number up to the nearest integer or multiple of significance |
| `CONCAT` | Joins two or more text strings into one |
| `FLOOR` | Rounds a number down to the nearest integer or multiple of significance |
| `IF` | Returns one value if a condition is TRUE, another if FALSE |
| `IFS` | Checks multiple conditions and returns the value for the first one that's TRUE |
| `LEFT` | Returns the first N characters of a text string |
| `LEN` | Returns the number of characters in a text string |
| `NOT` | Reverses the logic of its argument |
| `OR` | Returns TRUE if any argument is TRUE |
| `REGEXTEST` | Tests whether a text string matches a regular expression pattern |
| `RIGHT` | Returns the last N characters of a text string |
| `ROUND` | Rounds a number to a specified number of digits |
| `SUM` | Calculates the sum of a series of numbers |
| `SWITCH` | Compares a value against a list and returns the result for the first match, with an optional default |

## Operators

| Operator | Description |
| :- | :- |
| `=` | Equal to |
| `>` | Greater than |
| `<` | Less than |
| `>=` | Greater than or equal to |
| `<=` | Less than or equal to |
| `<>` | Not equal to |
| `+` | Addition |
| `-` | Subtraction |
| `*` | Multiplication |
| `/` | Division |
| `%` | Percent |

## Example: Adding a New Marketing Channel

Say your Marketing Channel field uses UTM data to assign a channel, and you want to add a new category — for example, "AI Search." Add a new condition to your existing formula, typically as a new line:

```text theme={null}
=IFS(
 REGEXTEST(CONCAT(utm_medium, ";", utm_source), "video"), "Video",
 REGEXTEST(CONCAT(utm_medium, ";", utm_source), "display"), "Display",
 REGEXTEST(CONCAT(utm_medium, ";", utm_source), "ai( )?search"), "AI Search",
 ...
 AND(utm_medium = "", utm_source = ""), "No UTM parameter data",
 TRUE, "Uncategorized Channel"
)
```

Click **Refresh** to confirm calls are now mapping to "AI Search" in the preview table, then **Apply** and **Save** to finalize.

## Where Marketing Channel Data Is Available

* **In the Lead Conversion Dashboard (retroactive):** to support historical trend analysis, this dashboard calculates Marketing Channel dynamically — updating your formula recalculates the dashboard's historical data with the new logic.
* **Everywhere else (forward-looking):** in reporting, integrations, and elsewhere, Marketing Channel behaves like any other Marketing Data Field — the formula applies at the moment the call completes, so formula updates only affect future calls.

## FAQ

**What's the difference between "Uncategorized Channel" and "No UTM parameter data"?**
"No UTM parameter data" means the call lacked UTM tracking information entirely — often direct traffic or an untracked offline campaign. "Uncategorized Channel" means the call had UTM data, but it didn't match any of your defined channel rules — suggesting a new traffic source or a rule that needs refining.

**Why do my Marketing Channel call volumes differ between the Lead Conversion Dashboard and other reports?**
The Lead Conversion Dashboard applies your current formula retroactively to historical calls, including calls that occurred before the field was created, and recalculates volumes whenever you edit the formula. Other reports only show data for calls after the field was created, and preserve the value assigned at the time of the call rather than recalculating it. Use the Lead Conversion Dashboard to see your current definition applied across time, and other reports for the historical record of how calls were categorized when they occurred.

## Where to go next

* [Creating Marketing Data Fields](/s/article/creating-marketing-data-fields)
* [Editing Marketing Data Fields](/s/article/editing-marketing-data-fields)
* [Why Can't a Super User Add Marketing Data Fields?](/s/article/super-user-marketing-data-fields)
* [Static Marketing Data Mapping](/s/article/static-marketing-data-mapping)
