DAX Language - COUNT and COUNTX

A-Badde | Posted on April 09, 20

COUNT Function


The COUNT function counts the number of non blank cells in a column.

 Return Value:

COUNT returns a whole number, that is the number of non blank cells in the column.


COUNT( <ColumnName> ) 
  • Description of the parameter:





Column that contains the values to be counted



  The following example counts the number of values in the column ContinentName.

Number_Continent = COUNT( Geography[ContinentName] )

The COUNT function accepts a column as argument only, and that contains numbers, dates or strings values.


COUNTX Function


The COUNTX function counts the number of rows that contain a non-blank value when evaluating an expression over a table.

 Return Value:

COUNTX returns an integer value, result of the count.


COUNTX( <Table>,<Expression> )
  • Description of the parameters:





The table containing the rows to be counted


The expression to be evaluated for each row of the table.



To calculate the number of rows in the Product table of type "Televisions", and which have a Unit price, we can use the following formula:

Measure =

This formula passes a filtered table to COUNTX for the first argument. Using FILTER and RELATED functions, we will return all products whose sub category is Televisions, and then counts the rows in the resulting table that have a list price.

The first argument of the COUNTX must always be a table, or any expression that returns a table. The second argument is the column or expression that is searched by COUNTX.


  • COUNT and COUNTX return a blank if there are no rows to count. 
  • TRUE/FALSE values are not supported


Related Video:


(0) Comments

There is no comment

Leave a Comment
Add to favorite
Recent Posts
DAX Language - CONTAINS Function
A-Badde | May 09, 20

The CONTAINS function returns a boolean value, TRUE if each ...Read More

DAX Language - RANKX Function
A-Badde | May 05, 20

The RANKX function returns a single integer value that repre...Read More

DAX Language - AND and OR Functions
A-Badde | April 10, 20

AND/OR functions check whether all arguments are TRUE or one...Read More

DAX Language - Variables in DAX
A-Badde | April 10, 20

Use Var keyword to store the result of an expression as a na...Read More