---
title: SUMX
description: Learn how to use the SUMX function for conditional sum calculations. Explore syntax, examples, and practical applications for analyzing data and optimizing dashboard performance effectively.
---
import { Aside, Steps } from '@astrojs/starlight/components';

# SUMX

The SUMX function in Infoveave calculates the sum of values in a column based on a specified condition.

## Applicable to

* Calculated Columns
* Expressions

## Return Value

The sum of values meeting the specified condition.

## Remark

* SUMX performs conditional sum calculations within datasets. It evaluates the condition for each row and sums values meeting the condition.
* SUMX cannot be used across dates and strings.
* SUMX ignores null and blank values.

## Syntax

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

## SUMX in Board Expression

<Aside>
Expressions add visual effects to your dashboard through widget-specific conditions. They don't manage or modify data.
</Aside>

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

Steps to Use SUMX

<Steps>
1. Write the SUMX function. For instance `SUMX(<expression>,<condition>)`
2. Replace `<expression>` with `'Widget Name'[Measure]` and `<condition>` with `[Dimension Name]="Dimension Value"`. Replace **Widget Name**, **Measure**, **Dimension Name**, and **Dimension Value** with your actual values.
3. To learn how to configure an Expression in Infoveave, visit [Configure Expression](/insights-v8/advanced-configuration/#configuring-expressions).
</Steps>

<div role="alert">

**Scenario** Managing a Solar Energy Dashboard to monitor the cumulative impact of solar and total customer numbers on a KPI. Calculate the product of solar customers ('Solar Feed In' dataset) and total customers ('Solar Total' dataset) to check if it surpasses a threshold.

**Scenario Details**

* **Dashboard Name** Solar Energy Dashboard
* **Widget Name** Solar Feed In
* **Measure** Solar Customers
* **Dimension** Discount Types
* **Dimension Value** "Pay on Time"

**Objective** Track and analyze the performance of solar customers who pay on time, ensuring the count doesn't exceed 20.

You can use the SUMX function like this

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

## SUMX in Calculated Columns

| Parameter      | Description                                                              |
|----------------|--------------------------------------------------------------------------|
| Expression     | A placeholder replaced with column names.                                |
| Condition      | A placeholder replaced with the condition filter.                        |
| Column Name    | The column name containing values you want to analyze.                   |
| Filter Condition | A filter condition (string or numeric) returning data points to analyze.|

Steps to Use SUMX in Calculated Columns

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

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

<div role="alert">

**Objective** Find the maximum entry value under MARKET PRICE where 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     | 50.8155      | 8        |
| 2024-01-14 | Brazil  | Snacks     | 20.185     |              | 4        |
|            | Brazil  | Cosmetics  | 40.485     | 46.1529      | 2        |

You can use the SUMX function like this

```
SUMX([QUANTITY], [CATEGORY]="Cereal")
```

The new calculated column "Unit Sold" will return 17 (total rows considering nulls and blanks).

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