---
title: DISTINCTCOUNT
description: Learn how to use the DISTINCTCOUNT function in Infoveave to count unique, non-duplicate values in your datasets.
---
import { Aside, Steps } from '@astrojs/starlight/components';

# DISTINCTCOUNT

The DISTINCTCOUNT function in Infoveave calculates the number of unique, distinct values in a column or dataset. It counts how many different items are present without considering duplicates.

## Applicable to

* Calculated Columns
* Expressions

## Return Value

* The return value of the DISTINCTCOUNT function is an integer representing the count of unique, non-duplicate values in the specified column.

## Remark

* DISTINCTCOUNT is useful when you want to know how many distinct items are in a particular column, such as counting the number of unique customers, products, or categories.
* DISTINCTCOUNT function can be used across Date, Strings and Numbers.
* DISTINCTCOUNT function takes all values into account.

## Syntax

```
DISTINCTCOUNT(<expression>)
```

## DISTINCTCOUNT 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.                       |
| 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.                     |

Steps to Use DISTINCTCOUNT

<Steps>
1. Write the DISTINCTCOUNT function. For instance `DISTINCTCOUNT(<expression>)`
2. Replace `<expression>` with `'Widget Name'[Measure]`. Replace **Widget Name** with the actual name of your widget and **Measure** with the corresponding measure name.
3. Set the condition with the DISTINCTCOUNT function based on the scenario. For instance, you can set the count entries that meet a certain criterion, as the condition.
4. 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're overseeing a dataset and an Infoboard titled 'Green Solar' within your Energy Consumption Analysis System. Your goal is to count the number of unique solar customers without counting any customer twice. This is vital for assessing customer engagement and ensuring data accuracy.

**Scenario Details**

* **Dashboard Name** Consumption Analysis 
* **Widget Name** Green 
* **Measure Name** Customers (representing the number of customers)

**Objective** Your objective is to count the number of unique customers without counting any customer twice. If this count equals 100, you want to trigger a specific action on your dashboard.

* You can use the DISTINCTCOUNT function like this

```
DISTINCTCOUNT('Green'[Customers])=100
```
</div>

## DISTINCTCOUNT in Calculated Columns



| Parameter   | Description                                                                                   |
|-------------|-----------------------------------------------------------------------------------------------|
| Expression  | A placeholder in a function that is replaced with the column names.                            |
| Column Name | The name of the column in the dataset or Datasource that contains the values you want to analyze. |

Steps to use DISTINCTCOUNT in Calculated Columns

<Steps>
1. Write the DISTINCTCOUNT function. For instance `DISTINCTCOUNT(<expression>)`
2. Replace `<expression>` with `[Column Name]`. Replace **Column Name** with the actual name of your column required.
3. To learn how to add calculated columns in Infoveave, visit the section [Calculated Columns](/studio-v8/datasources/calculated-columns-datasource/).
</Steps>

<div role="alert">

**Objective** Consider that you have the below sales dataset, your goal is to count the number of distinct values in the column COUNTRY.

| 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 DISTINCTCOUNT function like

```
DISTINCTCOUNT([COUNTRY])
```

The new calculated column "Total Entries" will return the total number of rows in the dataset considering nulls and blanks as **4**.

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

<Aside>
*The DISTINCTCOUNT function allows you to apply multiple conditions, such as counting the number of distinct values when the COUNTRY is "Brazil" and the CATEGORY is "Baby Food".

```
DISTINCTCOUNT([COUNTRY], [COUNTRY]="Brazil", [CATEGORY]="Baby Food")
```

*You can apply date conditions when using the DISTINCTCOUNT function as below

```
DISTINCTCOUNT([ORDER DATE], [ORDER DATE]=DATEVALUE("2024-05-05"))
```
</Aside>



