Home » DAX » DAX – COUNTBLANK Function

DAX – COUNTBLANK Function

Countblank dax

COUNTBLANK DAX function is used to counts the number of blank cells in a column. This function comes under Aggregation Functions DAX category.

Refer similar DAX : COUNTROWS , DISTINCTCOUNT COUNT, COUNTA & COUNTX

Syntax:

COUNTBLANK(<column>)




Description:

S no. Parameter Description
1 column The column that contains the blank cells to be counted.

Dataset format as below:

ID Amount Blank Boolean SalesDate Name
1 TRUE 29/5/2020 A
2 1000 FALSE B
3 2000 TRUE 29/5/2020
4 1000 FALSE 28/5/2020 C





Step-1: Now, we will count the number of blank rows under the “Blank” column. To achieve this, let’s create a new measure.

COUNTBLANK = 
COUNTBLANK(SampleTable[Blank])

The measure above will return the number of blank rows under the “Blank” column as 4.

Step-2: Now try COUNTBLANK DAX with other columns

Count Blank with Amount Column:
COUNTBLANK = COUNTBLANK(SampleTable[Amount]) -----    Output = 1

Count Blank with SalesDate Column:
COUNTBLANK = COUNTBLANK(SampleTable[SalesDate]) ----- Output = 1

Count Blank with Id Column:
COUNTBLANK = COUNTBLANK(SampleTable[ID])

In the "ID" column, there are no blank rows, so the result will be "Blank."

Note:

  • The only argument allowed to this function is a column.
  • It will return a whole number. If no rows are found that meet the condition, blanks are returned.

Refer similar DAX : COUNTROWS , DISTINCTCOUNT ,  COUNT, COUNTA & COUNTX




Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome or you can leave us message on our contact form , we will revert to you asap.

Leave a Reply