---
schema_version: "1"
id: 14f83adfc0321b8cbe3441643256a61ed0cdd92dd8306353477b20b1b06901fc
title: Add a Formula Field in a Recipe
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/analytics/264-0-0/bi_integrate_data_prep_recipe_formula_field.md
canonical_url: https://help.salesforce.com/s/articleView?id=analytics.bi_integrate_data_prep_recipe_formula_field.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: cd9b6ccaac4c2bc0230a710044063647ea7597c3ac5b37de4333a199a59efdac
description: Add a formula field to calculate new values from measures and dimensions in your recipe.
products:
  - CRM Analytics
  - Cross Cloud
release: "264"
---
# Add a Formula Field in a Recipe

Add a formula field to calculate new values from measures and dimensions in your recipe.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in Salesforce Classic and Lightning Experience.</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available with CRM Analytics, which is available for an extra cost in <strong>Enterprise</strong>, <strong>Performance</strong>, and <strong>Unlimited</strong> Editions. Also available in <strong>Developer</strong> Edition.</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d59965e47">User Permissions
              Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d59965e47 ">To create a recipe:</td>
            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d59965e47 ">Edit CRM Analytics Dataflows OR Edit Dataset Recipes</td>
          </tr>
        </tbody>
      </table>

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/images/icon_note.png)

Note To create a calculated column based on a formula in a Data Prep recipe, see [Formula Transformation: Create a Calculated Column Based on an Expression](https://help.salesforce.com/s/articleView?id=analytics.bi_integrate_recipe_transformation_formula.htm&release=264.0.0&type=5 "In CRM Analytics, create a column in a Data Prep recipe that displays values based on a formula calculation. The calculation can include input from other fields in the same row or across rows. For example, you can create a Profit column based on input from Revenue and Cost columns. Enter formulas in EA-SQL format. EA-SQL is a collection of standard and custom functions for numeric, string, and date data."). To do it in a dataflow, see [computeExpression Transformation](https://help.salesforce.com/s/articleView?id=analytics.bi_integrate_saql_transformation.htm&release=264.0.0&type=5 "The computeExpression transformation enables you to add derived fields to a dataset. The values for derived fields aren’t extracted from the input data source. Instead, CRM Analytics generates the values using a SAQL expression, which can be based on one or more fields from the input data or other derived fields. For example, you can use an expression to assign a value to a field, concatenate text fields, or perform mathematical calculations on numeric fields.").

A formula field lets you calculate new values based on existing values in fields. To help you, a formula builder suggests fields and functions as you type.

1. To start creating a formula field, choose one of these methods.
    
    - To create the formula from scratch, click ![Column menu button](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/resources-global/analytics/images/bi_integrate_replication_actions_button.png) on any field column header, and then select **Formula**.
        
        The formula builder appears in the Add Transformation panel below the recipe preview.
        
        ![Add formula field dialog](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_integrate_data_prep_recipe_add_formula_field.png)
    - To use a suggested function, click the field that you want to use in the recipe preview, and then click a function in the suggestions bar below the preview.
        
        ![Suggestions bar showing suggestion available when a measure field is selected in the recipe preview](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_integrate_recipe_formula_suggestions.png)
        
        The formula is started for you, using the field and function that you selected.
        
        ![Pre-populated formula in formula field when a suggestion is selected](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_integrate_recipe_formula_using_suggestions.png)
    - To select multiple fields for use in your formula, while pressing Shift or Ctrl (Cmd on Mac), click the fields that you want to use in the recipe preview. Then click an function in the suggestions bar below the preview.
        
        ![Suggestions bar showing suggestion available when multiple fields are selected in the recipe preview](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_integrate_recipe_formula_suggestions_multiselect.png)
        
        The formula is started for you, using the fields and operator that you selected.
        
        ![Pre-populated formula in formula field when multiple fields are selected](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_integrate_recipe_formula_using_suggestions_ms.png)
2. In the formula builder, enter the formula. If the formula has been started for you, you can edit it here.
    
    ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/images/icon_note.png)
    
    Note Here are some tips for entering or editing your formula.
    
    - Just start typing to see matching functions and fields.
    - To select a match, either click it, or use your cursor up and down keys to select it and then press **Enter** or **Tab**.
    - Use your keyboard to enter parentheses, arithmetic operators, and numbers as needed.
    
    ![Formula builder](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_integrate_data_prep_recipe_formula_builder.png)
3. When you have completed the formula, click **Add**.
    
    The new formula field appears in the recipe preview.
    
    ![Formula field in recipe preview](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_integrate_data_prep_recipe_formula_field_result.png)

![Tip](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/images/icon_tip.png)

Tip You can bucket a formula field or reference it in other formulas in the recipe.

- **[Numeric Functions for Formula Fields](https://help.salesforce.com/s/articleView?id=analytics.bi_integrate_data_prep_recipe_formula_field_numericfunctions.htm&release=264.0.0&type=5)**  
    Use numeric functions to calculate new values from measures in your recipe. For example, you can round, truncate, and determine the absolute value of a number. The arguments in each function can be numbers or measure columns.
- **[String Functions for Formula Fields](https://help.salesforce.com/s/articleView?id=analytics.bi_integrate_data_prep_recipe_formula_field_stringfunctions.htm&release=264.0.0&type=5)**  
    Use string functions to create values in a formula field based on one or more dimension columns in your recipe or strings. For example, you can change the casing of text strings, concatenate values from multiple columns, and replace values.