Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Dhania_BI
Frequent Visitor

COUNTX or COUNTROWS to count rows of a filtered table?

Hello,

 

I was wondering which of the following measures is the best to count rows of a filtered table (and why) ? Is there actually a difference? The result in the same in my report.

Measure1 = COUNTX(FILTER(Table, Table[Unit price] >300), Table[Unit price])

Measure2 = COUNTROWS(FILTER(Table, Table[Unit price] > 300))
 
Thank you very much for your help.
 
1 ACCEPTED SOLUTION
Anand24
Super User
Super User

Hello @Dhania_BI ,

COUNTX will exclude white space and Boolean data, while COUNTROWS will also count them.

In addition, COUNTX is generally used for the appearance of measurements or numeric values.

You will get the same result in your case using both, as you are counting values from the filtered table.

Here's a video that could help you: https://www.youtube.com/watch?v=y2GPFFOW3fA

Give it a thumbs up if this post helped you in any way and mark this post as a solution if you solved your !!!

View solution in original post

2 REPLIES 2
Anand24
Super User
Super User

Hello @Dhania_BI ,

COUNTX will exclude white space and Boolean data, while COUNTROWS will also count them.

In addition, COUNTX is generally used for the appearance of measurements or numeric values.

You will get the same result in your case using both, as you are counting values from the filtered table.

Here's a video that could help you: https://www.youtube.com/watch?v=y2GPFFOW3fA

Give it a thumbs up if this post helped you in any way and mark this post as a solution if you solved your !!!

Thank you Anand, all clear!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.