COUNTAX

The COUNTAX function counts non-blank results when evaluating the result of an expression over a table.

Quick Coach Video

What it does?

The COUNTAX function counts non-blank results when evaluating the result of an expression over a table. That is, it works just like the COUNTA function, but it is used to iterate through the rows in a table and count rows where the specified expressions results in a non-blank result.

Syntax

COUNTAX( <table>, <expression>)

Returns

A whole number.

What is the COUNTAX Function?

The COUNTAX function in DAX is like a savvy detective—it counts the number of non-blank results from an expression evaluated over a table. It’s perfect for when you want to get insights based on specific conditions or calculations while keeping things exciting!

Example 1: Employee Project Contributions

Imagine you’re the captain of a dynamic team, and you want to know how many of your crew members contributed to projects last quarter. Here’s how your employee project data might look:

EmployeeProjects Table

Employee Name

Project Contributed

Chappel

3

Ace

0

Amelia

2

Jonathon

5

To count how many employees contributed to at least one project, you’d use the COUNTAX function like this:

Employees Contributing = COUNTAX(EmployeeProjects, 
EmployeeProjects[Projects Contributed])

Total Contributions Calculation:

  • Chappel: 3 (counted)
  • Ace: 0 (not counted)
  • Amelia: 2 (counted)
  • Jonathon: 5 (counted)

So, how many employees contributed to projects? That’s a total of 3 awesome employees!

Example 2: Ice Cream Sales

Now, let’s say you run a delightful ice cream shop and want to know how many customers ordered scoops of their favorite flavors last week. Here’s your sales data:

IceCreamSales Table

Customer Name

Scoops Ordered

Emma

2

Frank

3

Sabrina

0

Allison

1.

To count how many customers ordered at least one scoop, you would use COUNTAX like this:

Customers Who Ordered Scoops = 
COUNTAX(IceCreamSales, IceCreamSales[Scoops Ordered])

Total Orders Calculation:

  • Emma: 2 (counted)
  • Frank: 3 (counted)
  • Sabrina: 0 (not counted)
  • Allison: 1 (counted)

So, how many customers enjoyed some ice cream? That’s a total of 3 happy customers! 🎉🍦

Conclusion: Count It Up!

The COUNTAX function in DAX is your friendly helper for counting based on specific expressions or conditions. Whether it’s your team’s project contributions or the joy of ice cream sales, COUNTAX helps you turn data into delightful insights!

So, what are you waiting for? Let’s start counting with COUNTAX and celebrate your data victories! 🎊🥳