---
schema_version: "1"
id: 5e130e650429a2a15904d70cec7fedf27ce2d8b6015caf36be59024a26bdf739
title: Add Custom Formulas to Columns
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/analytics/264-0-0/bi_explorer_compare_table.md
canonical_url: https://help.salesforce.com/s/articleView?id=analytics.bi_explorer_compare_table.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 76c5688ed799cee3ed8513f90b4006c3fde5fa827a872f96a80fca6d205cc3f6
description: Use the column editor to define custom formulas in compare tables or charts. View measures side by side, and perform math across the table’s columns and rows. Use string values to create labels, concatenate dimension values, provide simple buckets, or add image URLs.
products:
  - CRM Analytics
  - Cross Cloud
release: "264"
---
# Add Custom Formulas to Columns

Use the column editor to define custom formulas in compare tables or charts. View measures side by side, and perform math across the table’s columns and rows. Use string values to create labels, concatenate dimension values, provide simple buckets, or add image URLs.

### 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="d138818e75">User Permissions Needed</th>
            </tr>
          </thead>
          <tbody>
            <tr class="">
              <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d138818e75 ">To view visualizations:</td>

              <td class="slds-cell-wrap" style="vertical-align:top;" headers="d138818e75 ">Use CRM Analytics</td>

            </tr>
          </tbody>
        </table>

1. In the lens, click the Table Mode icon and select **Compare Table**.
2. On the Data tab, click ![analytics explorer add button](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_explorer_add_button_icon.png) under Measures.
3. Add dimensions by clicking ![analytics explorer add button](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_explorer_add_button_icon.png) in the Group by panel.
    
    Null values that occur in the data are displayed as minus signs (-).
4. Change the first measure by clicking the initial selection (Count of Rows). Add more measures by clicking ![analytics explorer add button](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_explorer_add_button_icon.png) under Measures in the Data tab.
    
    ![explorer compare table with measures and dimension groupings](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_explorer_compare_table_example.png)
5. To enter a custom formula, click ![analytics explorer add button](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_explorer_add_button_icon.png) under Measures and click **Add Formula**.
    
    ![Add Formula](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_add_formula.png)
    
    In the column editor, you can enter text string formulas, SAQL formulas, including math functions, or choose a windowing function to calculate the values in the column. You can also name the column and choose a number format. If a formula contains division by 0, the result is displayed as a minus sign (-).
    
    ![Compare Table edit column](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_explorer_edit_column_details.png)
    
    If you want to preserve an existing column, select **Clone Column** from the original column's action menu. You can edit the cloned column instead of the original.
6. In the Formula field, create formulas using these operators.
    
      
    | **Symbol** | **Examples** | **Calculation** |
    | --- | --- | --- |
    | + | A+B, A+100 | Addition, applied per row. |
    | \- | A-B, A-100 | Subtraction, applied per row. |
    | / | A/B, A/100 | Division, applied per row. |
    | \* | A\*B, A\*100 | Multiplication, applied per row. |
    | ( ) | (B-A)/(A\*100) | Parentheses for grouping operations. |
    
    Dimension columns are on the left and measure columns are on the right. The measure columns are identified in formulas as A, B, C, and so on, with A being the far-left measure column.
    
    You can also create string formulas. For example, this formula creates simple buckets.
    
    ![Column editor showing a formula that creates three simple buckets](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_explorer_compare_table_string_formula.png)
    
    You can’t use columns based on string formulas as dimensions for grouping in charts, but you can use them to apply conditional formatting in charts.
7. To use SAQL, enter it directly into the formula editor, and click **Apply** to see the result.
    
    See the [CRM Analytics SAQL Developer Guide](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-intro.html) for more information on writing SAQL.
    
    Some SAQL functions can’t use letter references for columns, such as A, B, C. The `percentile_desc` and `percentile_cont` functions, for example, require raw field names as arguments. See [Use Raw Field Names in Query Formulas](https://help.salesforce.com/s/articleView?id=analytics.bi_explorer_formulas_raw_fields.htm&release=264.0.0&type=5 "When writing compare-table formulas, you can reference measure and group (dimension) columns by name. Referencing measure and group columns by name lets you write more intuitive and easily understandable formulas. Even better, the formula editor includes nifty function and formula pickers that save you time as you enter your SAQL formulas.") for more information.
    
    ![Compare Table formula editor SAQL](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_explorer_compare_saql.png)
8. To use a function, choose the function editor and then choose a windowing function from the menu. After you configure the function, click **Apply** to see the result.
    
    ![Compare Table function editor](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_explorer_compare_formula_menu.png)
    
    Switch to the formula editor to see the SAQL generated by the chosen function. You can edit the SAQL in the formula editor after generating it with a function as if you’d written it.
    
    ![Compare Table function editor SAQL](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_explorer_compare_formula.png)
    
    Filters on formula columns aren’t supported.
9. To open a column's action menu, click the down arrow.
    
    ![Compare Table Menu](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_explorer_compare_table_menu.png)
10. To change a column's name or formula, click **Edit this Column**.

Numeric formats use the period as a decimal separator and the comma as a grouping symbol. The currency formats are restricted to dollars and cents.