Counting Boolean Values in DAX Using COUNTA and COUNTAX

September 28, 2026 90 visits

In this article, we will learn how to count values in a DAX table, with a special focus on Boolean values such as TRUE and FALSE. We will compare COUNTA with COUNTAX and see how COALESCE can be used to treat blank Boolean values as FALSE.

📥 Practice Data:
Download Practice Data Free

🎥 Prefer learning through video?
DAX YouTube Playlist

What Are We Counting?

The query uses a table named CountTable and demonstrates three different counting expressions. The important part of this example is Column C, where the values can be Boolean or blank.

DAX Query
// Counting Boolean Value

EVALUATE
    CountTable

EVALUATE
    ROW(
        "Col C", COUNTA(CountTable[Column C]),
        "Col CX", COUNTAX(CountTable, COALESCE([Column C], FALSE())),
        "Col A", COUNTA(CountTable[Column A])
    )

1. Displaying the CountTable

Query

DAX Query
EVALUATE
    CountTable

Step-by-step explanation

Step 1: EVALUATE
EVALUATE is used to return a table expression as the result of the DAX query.

Step 2: CountTable
CountTable is the table expression being returned. This allows us to inspect the values in the table before applying the counting expressions.

Key takeaway:
The first EVALUATE statement helps you inspect the source table and understand which values are present, including Boolean and blank values.

2. Counting Column C Using COUNTA

Query

DAX Query
COUNTA(CountTable[Column C])

Step-by-step explanation

Step 1: CountTable[Column C]
The expression points directly to Column C in the CountTable table.

Step 2: COUNTA
COUNTA counts the non-blank values in the specified column. Therefore, Boolean values such as TRUE and FALSE are counted because they are values, not blanks.

If Column C contains blank values, those blank values are not counted by COUNTA.

Inside the ROW function

DAX Expression
"Col C", COUNTA(CountTable[Column C])

The text “Col C” becomes the name of the output column, while COUNTA(CountTable[Column C]) produces the count.

Key takeaway:
COUNTA counts non-blank Boolean values, including both TRUE and FALSE.

3. Counting Column C Using COUNTAX and COALESCE

Query

DAX Query
COUNTAX(
    CountTable,
    COALESCE([Column C], FALSE())
)

Step-by-step explanation

Step 1: COUNTAX
COUNTAX evaluates an expression for each row of the specified table and counts the non-blank results of that expression.

Step 2: CountTable
CountTable is the table over which the expression is evaluated row by row.

Step 3: [Column C]
Inside COUNTAX, [Column C] refers to the value of Column C for the current row.

Step 4: COALESCE
COALESCE([Column C], FALSE()) returns the value of [Column C] when it is not blank. If the value is blank, it returns FALSE.

This means that a blank value is converted into a Boolean value before COUNTAX performs the count.

How COALESCE Works
COALESCE([Column C], FALSE())
Column C Value COALESCE Result
TRUE TRUE
FALSE FALSE
BLANK FALSE

Because the expression always produces either TRUE or FALSE, the expression is non-blank for every row evaluated by COUNTAX.

Key takeaway:
When COALESCE([Column C], FALSE()) is used, blank values are converted to FALSE. Therefore, COUNTAX can count every row for which this expression is evaluated.

4. Counting Column A Using COUNTA

Query

DAX Expression
COUNTA(CountTable[Column A])

Step-by-step explanation

Step 1: Select Column A
The expression references CountTable[Column A].

Step 2: Apply COUNTA
COUNTA counts the non-blank values present in Column A.

This demonstrates that COUNTA is not limited to Boolean columns. It can be used to count non-blank values in different types of columns.

DAX Expression
"Col A", COUNTA(CountTable[Column A])

The result is returned as a column named Col A by the ROW function.


5. Understanding the ROW Function

Query

DAX Query
ROW(
    "Col C", COUNTA(CountTable[Column C]),
    "Col CX", COUNTAX(CountTable, COALESCE([Column C], FALSE())),
    "Col A", COUNTA(CountTable[Column A])
)

Step-by-step explanation

Step 1: ROW
ROW creates a single-row table from the name and expression pairs provided to it.

Step 2: Col C
The first expression counts non-blank values in Column C using COUNTA.

Step 3: Col CX
The second expression uses COUNTAX and converts blanks in Column C into FALSE using COALESCE.

Step 4: Col A
The third expression counts non-blank values in Column A using COUNTA.

Output structure

Output Column Expression What It Represents
Col C COUNTA(CountTable[Column C]) Non-blank values in Column C
Col CX COUNTAX(CountTable, COALESCE([Column C], FALSE())) Count after converting blanks to FALSE
Col A COUNTA(CountTable[Column A]) Non-blank values in Column A
Key takeaway:
The ROW function allows multiple scalar results to be displayed together as a single-row table.

6. COUNTA vs COUNTAX with COALESCE

Expression How It Works Blank Values
COUNTA(Column C) Counts non-blank values directly from the column Not counted
COUNTAX(Table, [Column C]) Evaluates Column C row by row and counts non-blank results Blank results are not counted
COUNTAX(Table, COALESCE([Column C], FALSE())) Converts blanks to FALSE before counting Converted to FALSE and therefore counted

The important difference is not simply COUNTA vs COUNTAX. It is the expression being evaluated by COUNTAX.

When the expression is wrapped with COALESCE, a blank value is replaced by FALSE. Since FALSE is a value and not blank, it can be counted by COUNTAX.


7. Why Use COALESCE for Boolean Values?

Boolean columns can contain three practical states: TRUE, FALSE, and BLANK. Sometimes the business logic requires a blank value to be interpreted as FALSE.

In that situation, COALESCE provides a convenient way to replace blanks with a default Boolean value.

Boolean Default Value
COALESCE([Column C], FALSE())

This expression can be read as:

  1. If Column C has a value, return that value.
  2. If Column C is blank, return FALSE.
Important:
Converting blank to FALSE changes the meaning of the data for the purpose of the expression. Use this approach when blank should logically be treated as false in your business scenario.

📝 Practice Exercise

Using the same CountTable, try creating a query that returns the following three counts:

  • Non-blank values from Column A
  • Non-blank values from Column C
  • Count of all rows after converting blank values in Column C to FALSE

Expected Pattern

DAX Query
EVALUATE
ROW(
    "Column A Count", COUNTA(CountTable[Column A]),
    "Column C Count", COUNTA(CountTable[Column C]),
    "Column C With Blank as False",
        COUNTAX(
            CountTable,
            COALESCE([Column C], FALSE())
        )
)

Conclusion

In this article, we explored how DAX can count Boolean and other values using COUNTA and COUNTAX.

  • COUNTA counts non-blank values in a column.
  • TRUE and FALSE are values and can therefore be counted by COUNTA.
  • COUNTAX evaluates an expression row by row and counts its non-blank results.
  • COALESCE can replace a blank Boolean value with FALSE.
  • When COALESCE([Column C], FALSE()) is used with COUNTAX, blank values become countable FALSE values.
  • ROW can combine multiple scalar calculations into a single-row result.

Understanding how blanks behave in DAX is important when working with Boolean columns, data-quality logic, and row-by-row expressions. The combination of COUNTAX and COALESCE gives you more control over how blank values are handled during counting.


📥 Practice Data:
Download Practice Data Free

🎥 Prefer learning through video?
DAX YouTube Playlist