Daily DAX : Day 382 COUNTA
Power BI DAX: COUNTA Function
Syntax
COUNTA(<column>)
Description
The COUNTA function counts the number of non-blank values in a column.
Unlike COUNT, which only counts numeric values, COUNTA counts all non-empty cells,
including text, numbers, dates, and logical values (TRUE/FALSE).
Parameters
- <column>: The column you want to count non-blank values from.
Return Value
A whole number representing the count of non-blank rows in the specified column.
Use Case Example
Scenario: You have a sales table with a column CustomerName. Some rows may have missing customer names.
Goal: Count how many orders have a customer name recorded.
DAX Measure:
Orders with Customer = COUNTA(Sales[CustomerName])
Result: Returns the total number of rows where CustomerName is not blank.
Common Use Cases
- Counting non-empty entries in text columns (e.g., product names, emails, comments).
- Measuring data completeness (e.g., how many records have a value in a specific field).
- Creating KPIs like "Number of Active Customers" or "Completed Surveys".
Important Notes
COUNTAignores completely blank cells but counts cells with empty strings ("") as non-blank.- Use
COUNTBLANKto count empty cells. - For counting rows regardless of blanks, use
COUNTROWS(Table).
Comparison with Similar Functions
| Function | Counts |
|---|---|
COUNT |
Numeric values only |
COUNTA |
Any non-blank value (text, number, date, etc.) |
COUNTAX |
Non-blank values in a table expression (advanced) |
COUNTROWS |
All rows in a table (ignores blanks in columns) |
Comments
Post a Comment