
You can create an event expression to enrich its parameters while creating different types of analyses (for example, metrics, segmentations, funnels, and so on). This means that you can use the result of the event expression as a special parameter of an event in other types of analytics. 


<div class="admonition admonition-tip"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" /></svg></div><div class="admonition-body"><div class="admonition-content">

You can use these expressions as event parameters for events in the remaining types of analyses (for example, segmentations, metrics, funnels, and so on).

</div></div></div>


## Requirements
---
A tracking code implemented into the website. 

## Creating an event expression
---

1. Go to <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/icons/behavioral-data-hub-icon.svg" alt="Behavioral Data Hub icon" class="icon"> **Behavioral Data Hub > Expressions > New expression**. 
2. To let other users know about the purpose of the expression, you can add a short description to it. 
3. To select the type of expression you want to create, click the <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/docs/analytics/_gfx/blue-arrow.png" alt="Blue arrow icon" class="icon"> icon. From the dropdown list select **Event**.
4. From the **Choose event** dropdown, select an event.
5. To start creating the formula of the expression, click the **Select** button. 
5. You can choose one of four elements: customer, constant, dynamic key, or a [function](/docs/crm/expressions/functions-in-expressions). 
6. To define the settings of the chosen element, click that element.
    - In case you choose a customer, select the customer attribute you want to include in the formula. 
    - In case you choose a constant, type the number or text (users can write a number in words, `nine` instead of `9`).
    - In case you choose a dynamic key, type in the key name (the ID of the key, for example `orderID`) and its default value. The default value will be replaced with the target one indicated in, for example, the request for expression result (when you request the expression result through Synerise Analytics API).  
10. Define the dependencies between the elements in the expression by selecting the mathematical operators. 
11. To complete creating the expression, click **Save**. 

## Example of use
---
**Goal**: To create a metric that counts liters of sold liquid products.

**Prerequisites**: Non-standard attributes for **bought product** event: `product quantity` and `product volume`. Instruction for adding event parameters available at the [link](/docs/assets/events/adding-event-parameters).

**Steps**:

1. Go to <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/icons/behavioral-data-hub-icon.svg" alt="Behavioral Data Hub icon" class="icon"> **Behavioral Data Hub > Expressions > New expression**. 
2. Enter the name of the expression. 
        
   <div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

   The name of the event expression becomes also the name of the parameter of the event.

   </div></div></div>

2. Select **Event** as a type of expression. 
2. From the **Choose event** dropdown, select the `Bought products` event. 
4. Click the **Select** button.  
    **Result**: A dropdown list appears.
6. From the dropdown list select **Event attribute**.
5. To display the settings of the event attribute, click it. 
6. From the **Choose parameter** dropdown, select `quantity`.
7. Next to the added event attribute, click the plus button.
    **Result**: A dropdown list appears. 
8. From the dropdown list, select **Event attribute**. 
9. To display the settings of the event attribute, click it. 
10. From the **Choose parameter** dropdown, select `volume`.
11. Multiply those two attributes, by selecting the multiplication sign between two event attributes. 
12. To complete, click **Save**. 
  
    <figure>
    <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/docs/analytics/_gfx/event-expression.png" alt="A final form of an expression" class="full">
    <figcaption>A final form of an expression</figcaption>
    </figure>
      

1.  Go to <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/icons/decision-hub-icon.svg" alt="Decision Hub icon" class="icon"> **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As a type, select **Simple metric**.
3. As the aggregator, set `Count`.
4. As the occurrence type, set `All`. 
5. From the **Choose event** dropdown list, select `Bought product`.
6. Click <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/docs/analytics/_gfx/where-icon.png" alt="where icon" class="icon"> button.  
    **Result**: The **Choose parameter** button appears. 
7. Click the **Choose parameter** button.  
    **Result**: A pop-up appears.
8. On the pop-up, click the three-dot button.  
    **Result**: A dropdown shows.
9. From the dropdown, select **Expressions**. 
10. In the list of expressions, find the event expression you have just created.
11. To select a specific time range, click the calendar icon. Confirm your choice with the **Apply** button.
12. To complete the process, click **Save**.

<figure>
<img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/docs/analytics/_gfx/expressions11.png" alt="A final form of a metric" class="full">
<figcaption>A final form of a metric </figcaption>
</figure>

**Output**: The metric counts the number of liters of purchased products in the form of a liquid from 6th of May to 6th of June. In this example, the number of purchased products is changeable, however, the product capacity is always the same and sourced from the product feed.