Skip to content

COUNTX

COUNTX is a widely used function in data analysis that calculates the number of rows or entries within a specified table or reference that meet specific conditions defined by an expression. It provides a count of rows where the given condition evaluates to true.

Applicable to

  • Calculated Columns
  • Expressions

Return Value

  • The return value of the COUNTX function is an integer representing the count of rows within the specified reference where the condition evaluates to true.

Remark

  • COUNTX is particularly useful when you need to count rows based on complex conditions or expressions.
  • COUNTX enables you to perform conditional counting and filtering within datasets.
  • COUNTX helps to identify and quantify specific patterns or subsets of data.
  • COUNTX function can be used across Date, Strings and Numbers.

Syntax

COUNTX(<expression>,<condition>)

COUNTX in Board Expression

Parameters

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 COUNTX

  1. Write the COUNTX function. For instance COUNTX(<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. Set the COUNTX function based on the scenario.
  4. To learn how to configure an Expression in Infoveave, visit the section Configure Expression.

Example Scenario you’re managing a dataset and an associated Infoboard within your Food Sales Analysis System. Your objective is to identify and count the number of customers who qualify for a special “Frequent Buyer” discount.

Scenario Details

  • Dashboard Name Food Sales Dashboard
  • Widget Name Customer Loyalty
  • Measure Name Customers (quantifying the number of eligible customers)
  • Dimension Name Purchase Behavior (categorizing customers based on their purchase behavior)
  • Dimension Value “Frequent Buyers” (representing customers who pay their bills on time)

Objective Your dataset includes information on food sales customers, and you’re interested in counting the number of solar customers who are eligible for the “Frequent Buyers” discount.

  • You can use the COUNTX function like this
COUNTX('Customer Loyalty '[Customer], [Discount Types] = "Frequent Buyers")>50

COUNTX in Calculated Columns

Parameters

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 COUNTX in Calculated Columns

  1. Write the COUNTX function. For instance COUNTX(<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.

Objective Consider that you have the below sales dataset, your goal is to count the number of rows in the dataset where COUNTRY is BRAZIL

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

COUNTX([COUNTRY],[COUNTRY]="Brazil")

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

ORDER DATECOUNTRYCATEGORYUNIT PRICEMARKET PRICEQUANTITYCOUNTRY COUNT
03-01-2024BrazilBaby Food38.4143.787425
07-01-2024JapanSpices45.5650.8155205
Japan43.7874105
18-01-202432.301945
22-01-2024BrazilCosmetics28.33523.010975
26-01-2024Canada20.18523.010995
04-01-2024FranceCereal25.2628.796495
09-01-2024BrazilCereal44.57550.815585
14-01-2024BrazilSnacks20.18545
BrazilCosmetics40.48546.152925