---
title: AVERAGEX
description: Learn how to use the AVERAGEX function for conditional average calculations, manage dashboards, configure expressions, and optimize data visualization with practical examples and syntax.
---
import { Aside, Steps } from '@astrojs/starlight/components';

# AVERAGEX

The AVERAGEX function in Infoveave is used to calculate the average of values within a column, taking into account a specified condition defined by the argument.

## Applicable to

* Calculated Columns
* Expressions

## Return Value

The return value of the AVERAGEX function is the sum of values within the dataset or table that satisfy the specified condition.

## Remark

* AVERAGEX is a function that allows you to perform conditional average calculations within datasets.
* It evaluates the condition for each row in the dataset and includes values that meet the condition.
* AVERAGEX function cannot be used across date and strings.
* AVERAGEX function neglects all nulls and blank values.

## Syntax

```
AVERAGEX(<expression>,<condition>)
```

## AVERAGEX in Board Expression

<Aside>
Expressions help you add visual effects to your dashboard through widget-specific conditions. It is important to note that the Expressions are not meant to manage or modify data.
</Aside>

| Parameter      | Description                                                                                                    |
|----------------|----------------------------------------------------------------------------------------------------------------|
| Expression     | A placeholder in a function that is replaced with the actual widget and measure names.                         |
| Condition      | A placeholder in a function that is replaced with the condition filter.                                        |
| Widget Name    | The specific name or identifier of the widget being used for data visualization in the specific Infoboard.     |
| Measure        | Represents the name of the measure that is being displayed or analyzed using the widget.                       |
| Dimension      | Represents the dimension column that is being displayed or analyzed using the widget.                          |
| Dimension Value| Represents the specific dimension items within the dimension column used for the visualization in the widget.  |

Steps to Use AVERAGEX

<Steps>
1. Write the AVERAGEX function. **For instance** `AVERAGEX(<expression>,<condition>)`
2. Where `expression` equals `'Widget Name'[Measure]` and `condition` equals `[Dimension Name]="Dimension Value"`.Replace **Widget Name** with the actual name of your widget, **Measure** with the required measure name, **Dimension** with the required dimension name and **Dimension Value** with the dimension value of the selected dimension name.
3. To learn how to configure an Expression in Infoveave, visit the section [Configure Expression](/insights-v8/advanced-configuration/#configuring-expressions).
</Steps>

<div role="alert">

**Scenario** You are responsible for managing an Energy Dashboard in Infoveave, and your primary objective is to monitor the average customer numbers on a key performance indicator.

**Scenario Details**

* **Dashboard Name** Energy Dashboard
* **Widget Name** Customers
* **Measure** Total Customers (quantifying the number of customers)
* **Dimension** Discount Types (categorizing customers based on their payment behavior)
* **Dimension Value** "Pay on Time" (representing customers who pay their bills on time)

**Objective** Your objective is to keep track and analyze the performance of solar customers based on their payment behavior. In this scenario, you want to make sure that the average number of customers who have a payment type of "**Pay on Time**" and ensure that this count exceed 200.

You can use the AVERAGEX function like this

```
AVERAGEX('Solar Feed In'[Solar Customers], [Discount Type]="Pay on Time") > 200
```
</div>

## AVERAGEX in Calculated Columns

| Parameter       | Description                                                                                           |
|-----------------|-------------------------------------------------------------------------------------------------------|
| Expression      | A placeholder in a function that is replaced with the column names.                                    |
| Condition       | A placeholder in a function that is replaced with the condition filter.                                |
| Column Name     | The name of the column in the dataset or Datasource that contains the values you want to analyze.       |
| Filter Condition| A filter condition returns the data points that meet the defined condition that you want to analyze. The filter condition can be either a string or a numeric. |

Steps to Use AVERAGEX in Calculated Columns

<Steps>
1. Write the AVERAGEX function. For instance `AVERAGEX(<expression>,<condition>)`
2. Replace `<expression>` with required `[Column Name]` and `<condition>` equals `[Column Name]="Filter Condition"`
3. Replace **Column Name** with the actual name of your column and **Filter Condition** with the required condition to be applied on the columns.
4. To learn how to add calculated columns in Infoveave, visit the section [Calculated Columns](/studio-v8/datasources/calculated-columns-datasource/) under Sources.
</Steps>

<Aside type="caution">
Do not use double quotes when setting up a numeric as the filter condition.
</Aside>

<div role="alert">

**Objective** Consider that you have the below sales dataset, your goal is to find the average UNIT PRICE for the COUNTRY is Brazil.

| ORDER DATE | COUNTRY | CATEGORY | UNIT PRICE | MARKET PRICE | QUANTITY |
|------------|---------|----------|------------|--------------|----------|
| 2024-01-03 | Brazil  | Baby Food| 38.41      | 43.7874      | 2        |
| 2024-01-07 | Japan   | Spices   | 45.56      | 50.8155      | 20       |
|            | Japan   |          |            | 43.7874      | 10       |
| 2024-01-18 |         |          |            | 32.3019      | 4        |
| 2024-01-22 | Brazil  | Cosmetics| 28.335     | 23.0109      | 7        |
| 2024-01-26 | Canada  |          | 20.185     | 23.0109      | 9        |
| 2024-01-04 | France  | Cereal   | 25.26      | 28.7964      | 9        |
| 2024-01-09 | Brazil  | Cereal   | 44.575     | 53.8155      | 8        |
| 2024-01-14 | Brazil  | Snacks   | 20.185     |              | 4        |
|            | Brazil  | Cosmetics| 40.485     | 46.1529      | 2        |

You can use the AVERAGEX function like

```
AVERAGEX([QUANTITY] , [COUNTRY]="Brazil")
```

The new calculated column "Unit Sold" will return the total number of rows in the dataset considering nulls and blanks as **34.4**

| ORDER DATE | COUNTRY | CATEGORY | UNIT PRICE | MARKET PRICE | QUANTITY | AVE UNIT PRICE |
|------------|---------|----------|------------|--------------|----------|----------------|
| 03-01-2024 | Brazil  | Baby Food| 38.41      | 43.7874      | 2        | 34.4           |
| 07-01-2024 | Japan   | Spices   | 45.56      | 50.8155      | 20       | 34.4           |
|            | Japan   |          |            | 43.7874      | 10       | 34.4           |
| 18-01-2024 |         |          |            | 32.3019      | 4        | 34.4           |
| 22-01-2024 | Brazil  | Cosmetics| 28.335     | 23.0109      | 7        | 34.4           |
| 26-01-2024 | Canada  |          | 20.185     | 23.0109      | 9        | 34.4           |
| 04-01-2024 | France  | Cereal   | 25.26      | 28.7964      | 9        | 34.4           |
| 09-01-2024 | Brazil  | Cereal   | 44.575     | 53.8155      | 8        | 34.4           |
| 14-01-2024 | Brazil  | Snacks   | 20.185     |              | 4        | 34.4           |
|            | Brazil  | Cosmetics| 40.485     | 46.1529      | 2        | 34.4           |
</div>

