Forum Discussion
Is there any technical or practical difference between these two measures?
- 1 year ago
Hi ERing
The first one is faster as it simply counts the rows. The second one iterates row by row before evaluating and counting non-blank values in a specific column (Count_Job_Id). This extra step introduces additional overhead, especially if the column is a calculated column or if the dataset is large. Therefore, COUNTROWS is generally more efficient when you only need to count the number of rows that meet certain conditions, while COUNTX should be used when you're specifically interested in counting valid (non-blank) entries of a particular column within that filtered set.
Hi ERing,
Both will return the same rsult as long every row in your filtered table has non blank values.
COUNTROWS - simple counts everyrow that passess filter expression
COUNTX - Iterated the same filtered set of rows, but for each row it evaluates table ID and only increments the count
For more info:
Use COUNTROWS instead of COUNT in DAX - DAX | Microsoft Learn
COUNTROWS vs COUNT DAX Functions in Power BI – Simple Example
COUNTROWS counts rows.
COUNTX counts non-blank values of the expression you pass - Job_ID column
Please let me know if you have further questions.
If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks!
Best Regards,
Maruthi
LinkedIn - http://www.linkedin.com/in/maruthi-siva-prasad/
X - Maruthi Siva Prasad - (@MaruthiSP) / X