---
schema_version: "1"
id: f733f4bee4cdcfa759108d24903059fe69b2a0ad0227e5a5b4bf373b51d90a02
title: Additional Functions for Formulas
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/analytics/264-0-0/bi_integrate_recipe_additionalfunctions.md
canonical_url: https://help.salesforce.com/s/articleView?id=analytics.bi_integrate_recipe_additionalfunctions.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 92005272aea900c30b89b154679e0ac9d03179754c7d04c7427b809cd343b901
description: In CRM Analytics, these versatile functions can be used with the data types text, number, date_only, and datetime to build logic into your formulas.
products:
  - CRM Analytics
  - Cross Cloud
release: "264"
---
# Additional Functions for Formulas

In CRM Analytics, these versatile functions can be used with the data types text, number, date\_only, and datetime to build logic into your formulas.

## Additional Functions for Formulas

When entering a formula use the API name of the column in the expression, not the label. The parameters section is surrounded by parentheses.

The `case` function handles if/then logic for formulas. This function can be used with TEXT, NUMBER, DATE\_ONLY, and DATETIME data. The syntax is:

```
case primary_expr(optional)
	when condition
	then result_expr
	... 
	else 
	default_expr
end
```

The syntax includes these keywords and parameters:

- **case** and **end** keywords begin and close the expression
- **when** and **then** keywords define a conditional statement. You can include one or more conditional statements.
- condition is a logical expression that can be evaluated to true or false. Construct this expression with any values, identifiers, logical operator, comparison operator, or scalar functions (including date and math functions) supported by EA SQL. Example:
    
    ```
    eg xInt < 5 or  price > 1000 and price <= 2000
    ```
- result\_expr is an expression that can be evaluated by the EA SQL engine. You can include values, identifiers, and scalar functions, including date and math functions. The expression can evaluate to any data type, but the data type must be consistent among all conditional expressions. So if result\_expr is of NUMERIC type, then result\_expr2 … result\_exprN must also be of NUMERIC type. Example:
    
    ```
    abs(price)
    ```
- else allows a default expression to be specified. The else statement must follow the conditional when/then statement. There can be only one else statement. This parameter is optional.
- default\_expr is an expression that can be evaluated by the EA SQL engine. The outcome if the condition expression evaluates as false.

Here’s a `case` function example. Type is a field in the dataset. “New Business” and “Existing Business” are values of the Type field.

```
case 
    when Type = 'New Business'
    then 'NB'
    when Type = 'Existing Business' 
    then 'EB'
    else
    Type
end
```

The `coalesce` function returns the first non-null value in an expression. Otherwise, returns null. This function can be used with TEXT, NUMBER, DATE\_ONLY, and DATETIME data. The syntax is: `coalesce(expr1,expr2)`

The syntax includes these parameters:

- expr1 is the first field or text string to search for a non-null value
- expr2is the next field or text string to search for a non-null value