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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
a_gaisin
Frequent Visitor

use of a result of COUNTROWS function inside IF function (incorrect result)

Hello, I'm trying to create a new measure that will take value 1 if number of rows in a specific table is greater than 10, and 0 otherwise. Here's the code that I use: 

GreaterThanTen = IF(COUNTROWS(Table)>10,1,0)

 This measure always returns 0, although there are cases when it's supposed to be 1.

Can you please explain what's wrong?

Thank you.

2 REPLIES 2
Anonymous
Not applicable

We'd like to see the cases you mention.

Best
D
nandukrishnavs
Community Champion
Community Champion

@a_gaisin 

 

I have replicated your scenario.

GreaterThanTen = IF(COUNTROWS('Table')>10,1,0)

It is working for me

Capture.JPG

When I apply the filter it is returning zero, which is expected.

Capture.JPG

In your case, maybe some external filters are there. Verify that.

If you don't want to affect external filters, you can use ALL() or ALLEXCEPT() functions.



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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