Counts the number of rows in the specified column that contain non-blank values
Quick Coach Video |
What it does? Counts the number of rows in the specified column that contain non-blank values Syntax COUNTA([Column]) Returns A whole number. |
What is the COUNTA Function?
The COUNTA function in DAX is like the ultimate attendance tracker at a gathering—it counts all the entries in a column, regardless of whether they are numbers, text, or dates. It’s perfect for when you want to know how many items you have, even if some values are not numeric!
Example 1: Concert Craze
Imagine you’re organizing a concert and need to know how many ticket types were sold. Here’s how your ticket sales data might look:
Ticket Type |
Tickets Sold |
General Admission |
120 |
VIP |
45 |
Backstage Pass |
15 |
NULL |
|
To find out how many different ticket types you have, including those that sold no tickets, you’d use the COUNTA function like this:
Total Ticket Types Sold = COUNTA(Tickets[Tickets Sold])
Total Ticket Types Calculation:
- General Admission: 120
- VIP: 45
- Backstage Pass: 15
- NULL (not counted as a ticket type)
So how many different ticket types did you count? That’s a total of 3 ticket types! 🎤
Example 2: Library Loan Count
Picture this: you manage a library, and you want to find out how many unique book titles were checked out last month. Your check-out records might look like this:
Book Title |
Times Checked Out |
The Data Gatsby |
1 |
To Analyze a Mockingbird |
1 |
All Quiet on the Data Front |
1 |
Pride and Data |
1 |
NULL |
|
Total Unique Books Checked Out = COUNTA(Book Loans [Times Checked Out])
Total Unique Books Checked Out Calculation:
- The Data Gatsby
- To Analyze a Mockingbird
- All Quiet on the Data Front
- Pride and Data
- NULL (not counted as a title)
So, how many unique book titles did you count? That's a total of 4 titles checked out! 📚
Conclusion: Count It Up!
The COUNTA function in DAX is your trusty companion for getting a quick tally of all non-blank entries, whether it’s ticket types at a concert, book titles in a library, or any other list you can think of. With just a simple function, you can transform data into valuable insights and enhance your reports!
So, what are you waiting for? Let’s start counting with COUNTA! 🥳
Still Stuck?