DAX COUNT and COUNTX – Impact of Using Measures and Columns
In a previous post we looked at DAX SUM and SUMX expressions. We introduced a lot in that article. We mentioned table functions, iterators, row and filter context. We also looked at some measures and calculated columns. Did you notice in that article and video how there can be a different impact using measures and calculated columns?
In this article we are going to slow things down a little. We will look at DAX COUNT and COUNTX – Impact of Using Measures and Columns. Measures and columns work very different. Today, using Count and COUNTX you will see an example of how measures and columns can impact the results in a table or visualization.
COUNT comes from Excel and will count the number of cells in a column that contain a number. COUNT will include all fields that contain a zero. But it will exclude a field if it is blank. Text & true/false are excluded. If you want to count text or logical functions, you need to use COUNTA.
You will not (yet) find COUNTX in Excel. It's a new function to DAX. It works very like SUMX. COUNTX takes two arguments. the first must return a table and the values to count are the second argument. Like COUNT, COUNTX counts numbers so if you want to count text or logical functions you need to use COUNTAX.
Let’s hop into an example and have further look at COUNT and COUNTX. And the impact of creating a calculated column v’s a measure.
Sample Data
We are going to use the same data that we used in the previous article on SUM and SUMX.
Now there is value in Learning with The Excel Club and our Learn and Earn STEEM activities.
We are the first Excel, PowerBI and DAX blog in the world where you can Earn while you Learn.