Skip to content

DISTINCTCOUNTX

The DISTINCTCOUNTX function in Infoveave calculates the number of unique, distinct values in a column, while considering a specific condition or criteria.

Applicable to

  • Calculated Columns
  • Expressions

Return Value

  • The return value of the DISTINCTCOUNTX function is an integer representing the count of unique, non-duplicate values in the specified column that satisfy the specified condition.

Remark

  • DISTINCTCOUNTX is useful when you want to count the number of distinct items in a column or dataset while applying a specific condition or filter. It helps you find out how many unique items meet certain criteria.
  • DISTINCTCOUNTX function can be used across Date, Strings and Numbers.
  • DISTINCTCOUNTX function takes only all values into account.

Syntax

DISTINCTCOUNTX(<expression>,<condition>)

DISTINCTCOUNTX in Board Expression

ParameterDescription
ExpressionA placeholder in a function that is replaced with the actual widget and measure names.
ConditionA placeholder in a function that is replaced with the condition filter.
Widget NameThe specific name or identifier of the widget being used for data visualization in the specific Infoboard.
MeasureRepresents the name of the measure that is being displayed or analyzed using the widget.
DimensionRepresents the dimension column that is being displayed or analyzed using the widget.
Dimension ValueRepresents the specific dimension items within the dimension column used for the visualization in the widget.

Steps to Use DISTINCTCOUNTX

  1. Write the DISTINCTCOUNTX function. For instance DISTINCTCOUNTX(<expression>,<condition>)
  2. Replace <expression> with 'Widget Name'[Measure] and <condition> with [Dimension Name]="Dimension Value". Replace Widget Name, Measure, Dimension, and Dimension Value with your actual values.
  3. Set the DISTINCTCOUNTX function based on the scenario.
  4. To learn how to configure an Expression in Infoveave, visit the section Configure Expression.

Scenario You’re managing a dataset and an associated Infoboard named ‘Energy Feed,’ which tracks energy customer data, within your Energy Consumption Analysis System. Your goal is to precisely count the number of unique solar customers who qualify for either the “Pay on Time” or “No Discount” categories, without counting any customer more than once. This is vital for understanding customer segmentation and ensuring accurate data analysis.

Scenario Details

  • Dashboard Name Energy Consumption Dashboard
  • Widget Name Power Feed In
  • Measure Name Customers (representing the number of customers)
  • Dimension Name Discount Types (categorizing customers based on their payment behavior)
  • Dimension Values “Pay on Time” (customers who pay their bills on time) and “No Discount” (customers not eligible for any discount)

Objective Your objective is to count the number of unique customers who belong to either the “Pay on Time” or “No Discount” category. If this count equals 0, you want to trigger a specific action on your dashboard.

  • You can use the DISTINCTCOUNTX function like this
DISTINCTCOUNTX('Power Feed In'[Customers], [Discount Types] = "Pay on Time" AND [Discount Types]="No Discount")=0

DISTINCTCOUNTX in Calculated Columns

ParameterDescription
ExpressionA placeholder in a function that is replaced with the column names.
ConditionA placeholder in a function that is replaced with the condition filter.
Column NameThe name of the column in the dataset or Datasource that contains the values you want to analyze.
Filter ConditionA 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 DISTINCTCOUNTX in Calculated Columns

  1. Write the DISTINCTCOUNTX function. For instance DISTINCTCOUNTX(<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 the section Calculated Columns.

Objective Consider that you have the below sales dataset, your goal is to count the distinct number of rows in the dataset where COUNTRY is BRAZIL and CATEGORY is BABY FOOD.

ORDER DATECOUNTRYCATEGORYUNIT PRICEMARKET PRICEQUANTITY
2024-01-03BrazilBaby Food38.4143.78742
2024-01-07JapanSpices45.5650.815520
Japan43.787410
2024-01-1832.30194
2024-01-22BrazilCosmetics28.33523.01097
2024-01-26Canada20.18523.01099
2024-01-04FranceCereal25.2628.79649
2024-01-09BrazilCereal44.57550.81558
2024-01-14BrazilSnacks20.1854
BrazilCosmetics40.48546.15292

You can use the DISTINCTCOUNTX function like this

DISTINCTCOUNTX([COUNTRY],[COUNTRY]="Brazil" AND [CATEGORY]="Baby Food")

The new calculated column will return the total number of rows that met the condition as 1.

ORDER DATECOUNTRYCATEGORYUNIT PRICEMARKET PRICEQUANTITYCOUNTRY COUNT
03-01-2024BrazilBaby Food38.4143.787421
07-01-2024JapanSpices45.5650.8155201
Japan43.7874101
18-01-202432.301941
22-01-2024BrazilCosmetics28.33523.010971
26-01-2024Canada20.18523.010991
04-01-2024FranceCereal25.2628.796491
09-01-2024BrazilCereal44.57550.815581
14-01-2024BrazilSnacks20.18541
BrazilCosmetics40.48546.152921